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 ...
随机推荐
- Sublime Text 插件 & 使用技巧
20 个强大的 Sublime Text 插件http://blog.jobbole.com/58725/ 12个不可不知的Sublime Text应用技巧和诀窍http://segmentfault ...
- 1、揭秘通用平台的 HttpClient (译)
原文链接:Demystifying HttpClient APIs in the Universal Windows Platform 正打算翻译这篇文章时,发现园子里已经有朋友翻译过了,既然已经开始 ...
- Sql server之路 (六)上传服务器图片
原理: 上传图片的名字 插入到数据库里 上传图片的内容(二进制数据) 写到服务器指定的目录下 下次读取图片的时候 从数据库里的指定字段里读取图片文件名 从数据库的指定路径下 拼串成完成的路径 就可以下 ...
- laravel框架中widget模糊查询
.配置模糊查询的路由 Route::); .在widgets.php下注册widget <?php Widget::register() { $model = Str::stu ...
- Ubuntu小点汇总,更新中...
转自:http://blog.csdn.net/zxz_tsgx/article/details/39713627 昨天重装了Ubuntu14.04 64位版,又被一些基础操作/设置给搞怕了,以前安装 ...
- IIS-如果外网访问不到 域名
如果访问不到 域名 , 可以 给域名的目录 增加“IIS_IUSERS”权限.
- 神经网络:多层网络与C++实现
相关源码可参考最新的实现:https://github.com/ronnyyoung/EasyML ,中的neural_network模块,后持续更新,包括加入CNN的结构. 一.引言 在前一篇关于神 ...
- Touch 事件的分发和消费机制
Android 中与 Touch 事件相关的方法包括:dispatchTouchEvent(MotionEvent ev).onInterceptTouchEvent(MotionEvent ev). ...
- CodeForces 505B Mr. Kitayuta's Colorful Graph
Mr. Kitayuta's Colorful Graph Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d ...
- JVM的GC实现详解
新生代中的98%对象都是“朝生夕死”的,所以并不需要按照1:1的比例来划分内存空间,而是将内存分为一块比较大的Eden空间和两块较小的Survivor空间,每次使用Eden和其中一块Survivor. ...