jQuery Questions:Front-end Developer Interview Questions
Explain "chaining".
Chaining allows us to run multiple jQuery methods (on the same element) within a single statement.like this:
$(selector).doA().doB().doC()
Explain "deferreds".
The Deferred object, introduced in jQuery 1.5, is a chainable utility object created by calling the jQuery.Deferred() method. It can register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.
The Deferred object is chainable, similar to the way a jQuery object is chainable, but it has its own methods. After creating a Deferred object, you can use any of the methods below by either chaining directly from the object creation or saving the object in a variable and invoking one or more methods on that variable.
Simplely,the deferred object is the salution of callback function and aslo a asynchronous task runner.
What are some jQuery specific optimizations you can implement?
- selector optimization
- event delegation
- Cache jQuery selector results
- Minimize DOM operations
- Avoid repeated object creation
- Stop using jQuery when you only need selectors(you can import selector only)
What does .end() do?
End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.
How, and why, would you namespace a bound event handler?
Event namespacing provides a way to manage specific event handlers. For example, a plugin could namespace its event handlers to make them easier to unbind while still using anonymous functions. To namespace an event, just suffix the event type with a period and a name
Name 4 different values you can pass to the jQuery method.
- Selector (string)
- HTML (string)
- Callback (function)
- HTMLElement
- object
- array
- element array
- jQuery Object etc.
What is the effects (or fx) queue?
Show or manipulate the queue of functions to be executed on the matched elements.
What is the difference between .get(), [], and .eq()?
- .get() return a raw DOM element
- [] equal .get()
- .get(index):index could be a negative number
- [index]:index >=0
- .eq() return a jquery element
What is the difference between .bind(), .live(), and .delegate()?
- Using the .bind() method is very costly as it attaches the same event handler to every item matched in your selector.
- You should stop using the .live() method as it is deprecated and has a lot of problems with it.
- The .delegate() method gives a lot of "bang for your buck" when dealing with performance and reacting to dynamically added elements.
- That the new .on() method is mostly syntax sugar that can mimic .bind(), .live(), or .delegate() depending on how you call it.
- The new direction is to use the new .on method. Get familiar with the syntax and start using it on all your jQuery 1.7+ projects.
What is the difference between $ and $.fn? Or just what is $.fn.
$ = function(){}
$.fn = $.prototype = {};
Optimize this selector: javascript $(".foo div#bar:eq(0)")
$("#bar")
refs:
deferred-object
differences-between-jquery-bind-vs-live-vs-delegate-vs-on
queue
jQuery Questions:Front-end Developer Interview Questions的更多相关文章
- Front-end Developer Interview Questions
Front-end-Developer-Interview-Questions A list of helpful front-end related questions you can use to ...
- JS Questions:Front-end Developer Interview Questions
Explain event delegation Event delegation allows us to attach a single event listener, to a parent e ...
- HTML Questions:Front-end Developer Interview Questions
What's a doctype do? Instruct the browser to render the page. What's the difference between standard ...
- General Questions:Front-end Developer Interview Questions
What did you learn yesterday/this week? Learning Angular. What excites or interests you about coding ...
- CSS Questions:Front-end Developer Interview Questions
Describe what a "reset" CSS file does and how it's useful. What Is A CSS Reset? A CSS Rese ...
- WCF学习系列二---【WCF Interview Questions – Part 2 翻译系列】
http://www.topwcftutorials.net/2012/09/wcf-faqs-part2.html WCF Interview Questions – Part 2 This WCF ...
- WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】
http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...
- WCF学习系列四--【WCF Interview Questions – Part 4 翻译系列】
WCF Interview Questions – Part 4 This WCF service tutorial is part-4 in series of WCF Interview Qu ...
- 300+ Manual Testing and Selenium Interview Questions and Answers
Manual testing is a logical approach and automation testing complements it. So both are mandatory an ...
随机推荐
- php 的函数参数值类型限定
如例: function test(array $a,test $b){ /*...*/ } class test{ /*...*/ } test(array(),new test); 表示test函 ...
- Java Hour 26 Execution
有句名言,叫做10000小时成为某一个领域的专家.姑且不辩论这句话是否正确,让我们到达10000小时的时候再回头来看吧. 26 Hours. Java 虚拟机启动的时候加载一个指定的类然后调用该类中的 ...
- Java Hour8
有句名言,叫做10000小时成为某一个领域的专家.姑且不辩论这句话是否正确,让我们到达10000小时的时候再回头来看吧. 本文作者Java 现经验约为7 Hour,请各位不吝赐教. Hour8 Jav ...
- hdu 1215 筛法
求小于n的n的因子之和 Sample Input 3 2 10 20Sample Output 1 8 22 #include<cstdio> #include<iostream&g ...
- 开发Android 范的错误
1 在onCreate(Bundle savedInstanceState)方法中, 按钮单击事件的实现直接写在onCreate方法了里,这样就好导致这个按钮只能触发一次, 因为在Android体系中 ...
- LightOJ 1079 Just another Robbery 概率背包
Description As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (h ...
- tar.xz文件如何解压 (已验证)
XZ压缩最新压缩率之王 xz这个压缩可能很多都很陌生,不过您可知道xz是绝大数linux默认就带的一个压缩工具. 之前xz使用一直很少,所以几乎没有什么提起. 我是在下载phpmyadmin的时候看到 ...
- Javac早期(编译期)
从Sun Javac的代码来看,编译过程大致可以分为3个过程: 解析与填充符号表过程. 插入式注解处理器的注解处理过程. 分析与字节码生成过程. Javac编译动作的入口是com.sun.tools. ...
- mvc-5视图和模版
动态渲染视图 当待渲染的视图内容不多的时候,可以将视图元素放在控制器或者状态里 var views = document.getElementById("views"); view ...
- Codeforces Round #329 (Div. 2)
推迟了15分钟开始,B卡住不会,最后弃疗,rating只涨一分... 水(暴力枚举) A - 2Char /******************************************** ...