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的更多相关文章

  1. Front-end Developer Interview Questions

    Front-end-Developer-Interview-Questions A list of helpful front-end related questions you can use to ...

  2. JS Questions:Front-end Developer Interview Questions

    Explain event delegation Event delegation allows us to attach a single event listener, to a parent e ...

  3. 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 ...

  4. General Questions:Front-end Developer Interview Questions

    What did you learn yesterday/this week? Learning Angular. What excites or interests you about coding ...

  5. 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 ...

  6. WCF学习系列二---【WCF Interview Questions – Part 2 翻译系列】

    http://www.topwcftutorials.net/2012/09/wcf-faqs-part2.html WCF Interview Questions – Part 2 This WCF ...

  7. WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】

    http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...

  8. WCF学习系列四--【WCF Interview Questions – Part 4 翻译系列】

    WCF Interview Questions – Part 4   This WCF service tutorial is part-4 in series of WCF Interview Qu ...

  9. 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 ...

随机推荐

  1. wpa_supplicant.conf

    转自:http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf ### ...

  2. java类加载时机与过程

    转自:http://www.tuicool.com/articles/QZnENv 说明:本文的内容是看了<深入理解Java虚拟机:JVM高级特性与最佳实践>后为加印象和理解,便记录了重要 ...

  3. Chromium Embedded Framework 中文文档(简介)

    转自:http://www.cnblogs.com/think/archive/2011/10/06/CEF-Introduce.html 简介 Chromium Embedded Framework ...

  4. 利用windbg探索进程和进程上下文

    1.列出所有活动进程 使用!process命令可以打印出活动进程的信息.第一个参数是要打印的EPROCESS的地址,如果指定为0则表示打印所有的进程.第二个参数用于说明打印进程信息的详细级别.指定0则 ...

  5. 如何用SQL语句查询Excel数据?

    如何用SQL语句查询Excel数据?Q:如何用SQL语句查询Excel数据? A:下列语句可在SQL SERVER中查询Excel工作表中的数据. 2007和2010版本: SELECT*FROMOp ...

  6. safari的坑

    当将图片src设置为空字符的时候,图片仍然还在:

  7. logback 配置详解【讲解较全的博客网站】

    http://blog.csdn.net/haidage/article/category/812478 详解(一)http://blog.csdn.net/haidage/article/detai ...

  8. 简单几何(直线与线段相交) POJ 1039 Pipe

    题目传送门 题意:一根管道,有光源从入口发射,问光源最远到达的地方. 分析:黑书上的例题,解法是枚举任意的一个上顶点和一个下顶点(优化后),组成直线,如果直线与所有竖直线段有交点,则表示能穿过管道. ...

  9. ZOJ2587 Unique Attack(判定最小割唯一性)

    看了题解,自己大概想了下. 最小割唯一的充分必要条件是残量网络中所有点要嘛能从源点floodfill到要嘛能floodfill到汇点. 必要性,这是当然的,因为假设从源点floodfill或者从汇点反 ...

  10. HDU4135 Co-prime(容斥原理)

    题目求[A,B]区间内与N互质数的个数. 可以通过求出区间内与N互质数的个数的前缀和,即[1,X],来得出[A,B]. 那么现在问题是求出[1,X]区间内与N互质数的个数,考虑这个问题的逆问题:[1, ...