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. ListView配合CheckBox出现position位置错误的解决

    最近做checkBox和ListView配合使用,想把position的位置传入到 checkBox的onCheckedChanged,于是我就在getView的时候, 把position通过chec ...

  2. 【HTML5】video视频

    当前,video 元素支持三种视频格式: 格式 IE Firefox Opera Chrome Safari Ogg No 3.5+ 10.5+ 5.0+ No MPEG 4 9.0+ No No 5 ...

  3. javascript优化--10模式(设计模式)01

    单体模式:保证一个特定类仅有一个实例;即第二次使用同一个类创建新对象时,应该得到与第一个所创建对象完全相同对象: 在JS中,可以认为每次在使用对象字面量创建对象的时候,实际上就在创建一个单体: 当使用 ...

  4. Zookeeper实战之单机模式

    Zookeeper介绍 Zookeeper 分布式服务框架是用来解决分布式应用中经常遇到的一些数据管理问题,如:统一命名服务.状态同步服务.集群管理.分布式应用配置项的管理等.本文主要从使用者角度来介 ...

  5. Google地图接口API之地图事件(四)

    演示几个地图事件: 1. 点击标记缩放地图 仍然使用上一遍文章使用的英国伦敦的地图.点用户点击标记时实现缩放地图的功能(点击标记时绑定地图缩放事件). 代码如下: <html> <h ...

  6. 判断 Gym 100502K Train Passengers

    题目传送门 /* 题意:几个判断,车上的人不能 <0 或 > C:车上初始和结束都不能有人在 (为0):车上满员时才有等候的人 水题:难点在于读懂题目意思,状态不佳,一直没搞懂意思,在这题 ...

  7. 关于InputStream.read()方法的阻塞原理的测试

    最近在一家公司做java实习,写了个网络字节采集器.写了个单例TCPServer来采集数据,其中用到了InputStream.read()来读取数据.产生了一系列问题,下面做下总结: 关于while( ...

  8. LightOJ1105 Fi Binary Number(数位DP)

    题目要求第k个没有连续两个1的二进制数. 这算数位DP吧,只不过以前遇到的是统计区间的数字情况,而这题是求第几个数字,差不多是反过来的. 本来我想用状态dp[i][0/1]表示长度i末尾0或1的二进制 ...

  9. redis AND memcache

    memcache文章索引 MEMCACHE问题集锦[转] MEMCACHED 高可用方案 REPCACHED NOSQL之[MEMCACHED]学习 当 MySQL 和 Memcached 遇到尾部空 ...

  10. 转:JQuery中$.ajax()方法参数详解

    url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. type: 要求为String类型的参数,请求方式(post或get)默认为get.注意其他http请求方法,例如put和 ...