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 ...
随机推荐
- centos7下安装vsftpd配置
0. 首先安装ftp服务 yum install -y ftp 1. 通过yum install -y vsftp安装vsftp 2. 修改vi /etc/vsftpd/vsftpd.conf, ...
- thinkphp实现导航高亮的简单方法
经常会涉及到关于导航菜单高亮显示的问题,大多是通过配合js或者事先分配变量的方式来实现导航高亮的,这里提供另一种思路参考: <ul class="usermenu"> ...
- chromium的Backtrace记录
ffmpeg处理完视频流后,上层的webrtc调用错误,可以看出webrtc的调用过程: Backtrace: webrtc::RTPFragmentationHeader::CopyFrom [0x ...
- Struts2标签实现for循环
感悟:但是不建议使用这种方法,按照MVC框架的思想 ,应该把业务更多放在后台.前台尽量只进行数据展示. 转自:http://blog.csdn.net/guandajian/article/detai ...
- 【转】cloudera新增用户权限配置
转自 http://lookqlp.iteye.com/blog/2189119 . 配置起来较复杂,需要在有测试环境之后再进行配置测试. 之后是有上HUE的计划的,所以这个也是一定要做的. ...
- python 自定义排序函数
自定义排序函数 Python内置的 sorted()函数可对list进行排序: >>>sorted([36, 5, 12, 9, 21]) [5, 9, 12, 21, 36] 但 ...
- Java的内存模型
"让计算机并发执行若干个运算任务"与"更充分地利用计算机处理器的效能"之间的因果关系,看起来顺理成章,实际上它们之间的关系并没有想象中的那么简单,其中一个重要的 ...
- eBay 使用ReviseInventoryStatusCall调整库存和价格
1.简介 针对Fixed-Price的Item,其Inventory Revise和Price Revise可以使用接口ReviseInventoryStatusCall来完成. 其使用非 ...
- TYVJ P1029 牛棚回声 Label:坑
背景 USACO OCT09 3RD 描述 奶牛们灰常享受在牛栏中牟叫,因為她们可以听到她们牟声的回音.虽然有时候并不能完全听到完整的回音.Bessie曾经是一个出色的秘书,所以她精确地纪录了所有的牟 ...
- CentOS 下安装配置mongodb
先从这个地方下载 http://www.mongodb.org/downloads 然后#tar -zxvf mongodb-linux-x86_64-2.4.8.tgz # sudo mv mo ...