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 ...
随机推荐
- CSS选择器以及优先级与匹配原理
最常用的五类CSS选择器 准确而简洁的运用CSS选择器会达到非常好的效果.我们不必通篇给每一个元素定义类(class)或ID,通过合适的组织,可以用最简单的方法实现同样的效果.在实际工作中,最常用的选 ...
- Java vararg(动态参数)的应用
可变参数在JDK 1.5添加,刚才知道的. 以下来自<Java泛型和集合>一书. 将参数打包成一个数组传入方法中是一件让人讨厌的事,在jdk1.5中加入了一个新的功能称为vararg(动态 ...
- HDU 4258 Covered Walkway 斜率优化DP
Covered Walkway Problem Description Your university wants to build a new walkway, and they want at ...
- Apache服务器的下载与安装
关于PHP的运行环境搭载,网上文章繁杂,遂自己整理一篇! PHP的运行必然少不了服务器的支持,何为服务器?通俗讲就是在一台计算机上,安装个服务器软件,这台计算机便可以称之为服务器,服务器软件和计算机本 ...
- android webview与 java与javascript的交互
webView.getSettings().setJavaScriptEnabled(true);//打开就可以用js的功能 webView.getSettings().setJavaScript ...
- 【JSP jstl c标签】使用c:foreach 报错(警告)”test does not support runtime expressions“
后台封装的数据是个list,传递给前台,显示如下: <c:forEach items="${userInfo}" var="user"> 用户Nam ...
- CDH中,执行HIVE脚本表联查权限问题。。
文章来自http://www.cnblogs.com/hark0623/p/4174641.html 转发请注明 有时候执行表联查的时候总会出现没有权限写文件的情况. 这个时候使用sudo -H hi ...
- ember.js:使用笔记10 常用方法
init: controller中初始化方法, //注意该方法是在其他方法之前,所以取不出this,model等值: 跳转:this.tra ...
- http://jingyan.baidu.com/article/636f38bb3eb78ad6b8461082.html
http://jingyan.baidu.com/article/636f38bb3eb78ad6b8461082.html
- 2016 Multi-University Training Contest 8
solved 4/11 2016 Multi-University Training Contest 8 贪心 1001 Ball(BH) 代码: #include <bits/stdc++.h ...