Tải bản đầy đủ - 0 (trang)
#1. Every single thing in the jQuery library

#1. Every single thing in the jQuery library

Tải bản đầy đủ - 0trang

www.it-ebooks.info

leftovers



#1. Every single thing in the jQuery library (continued)

jQuery methods (continued)

.is()

jQuery.isArray()

jQuery.isEmptyObject()

jQuery.isFunction()

jQuery.isPlainObject()

jQuery.isWindow()

jQuery.isXMLDoc()

jQuery()

.jquery

.keydown()

.keypress()

.keyup()

.last()

.length

.live()

.load()

.load()

jQuery.makeArray()

.map()

jQuery.map()

jQuery.merge()

.mousedown()

.mouseenter()

.mouseleave()

.mousemove()

.mouseout()

.mouseover()

.mouseup()

.next()

.nextAll()

.nextUntil()

jQuery.noConflict()

jQuery.noop()

.not()

jQuery.now()

.offset()

.offsetParent()

.one()

.outerHeight()

.outerWidth()



jQuery.param()

.parent()

.parents()

.parentsUntil()

jQuery.parseJSON

jQuery.parseXML()

.position()

jQuery.post()

.prepend()

.prependTo()

.prev()

.prevAll()

.prevUntil()

.promise()

.prop()

jQuery.proxy()

.pushStack()

.queue()

jQuery.queue()

.ready()

.remove()

.removeAttr()

.removeClass()

.removeData()

jQuery.removeData()

.removeProp()

.replaceAll()

.replaceWith()

.resize()

.scroll()

.scrollLeft()

.scrollTop()

.select()

.serialize()

.serializeArray()

.show()

.siblings()

.size()

.slice()

.slideDown()



.slideToggle()

.slideUp()

.stop()

jQuery.sub()

.submit()

jQuery.support

.text()

.toArray()

.toggle()

.toggle()

.toggleClass()

.trigger()

.triggerHandler()

jQuery.trim()

jQuery.type()

.unbind()

.undelegate()

jQuery.unique()

.unload()

.unwrap()

.val()

jQuery.when()

.width()

.wrap()

.wrapAll()

.wrapInner()



you are here 4   449



www.it-ebooks.info

every single thing (cont’d)



#1. Every single thing in the jQuery library (continued)

jQuery selectors

All Selector ("*")

Attribute Contains Prefix Selector

[name|="value"]

Attribute Contains Selector [name*="value"]

Attribute Contains Word Selector [name~="value"]

Attribute Ends With Selector [name$="value"]

Attribute Equals Selector [name="value"]

Attribute Not Equal Selector [name!="value"]

Attribute Starts With Selector [name^="value"]

:animated Selector

:button Selector

:checkbox Selector

:checked Selector

Child Selector ("parent > child")

Class Selector (".class")

:contains() Selector

Descendant Selector ("ancestor descendant")

:disabled Selector

Element Selector ("element")

:empty Selector

:enabled Selector

:eq() Selector

:even Selector

:file Selector

:first-child Selector

:first Selector

:focus selector

:gt() Selector



450   appendix i



Has Attribute Selector [name]

:has() Selector

:header Selector

:hidden Selector

ID Selector ("#id")

:image Selector

:input Selector

:last-child Selector

:last Selector

:lt() Selector

Multiple Attribute Selector [name="value"]

[name2="value2"]

Multiple Selector ("selector1, selector2,

selectorN")

Next Adjacent Selector ("prev + next")

Next Siblings Selector ("prev ~ siblings")

:not() Selector

:nth-child() Selector

:odd Selector

:only-child Selector

:parent Selector

:password Selector

:radio Selector

:reset Selector

:selected Selector

:submit Selector

:text Selector

:visible Selector



www.it-ebooks.info

leftovers



#2. jQuery CDNs

CDNs (content delivery networks, or content distribution networks) are large networks of servers, designed to

store and deliver information—data, software, API code, media files or videos, etc.—making it easily

accessible on the Web. Each server in the node contains a copy of the data that is being served out.

When these nodes are strategically placed around a network—like the Internet—they can increase

the speed of information delivery to many more people consuming this data. Windows Azure and

Amazon CloudFront are examples of traditional CDNs.

A number of large enterprises provide hosted copies of jQuery on CDN networks that are available

for public use. Below are links to the CDN-hosted copies of jQuery that you may hotlink to.

Google Ajax API CDN

http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js

Microsoft CDN

http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js

jQuery CDN (via Media Temple)

http://code.jquery.com/jquery-1.6.2.min.js (Minified version)

http://code.jquery.com/jquery-1.6.2.js (Source version)



You can include these in your jQuery applications instead of downloading jQuery every time.



you are here 4   451



www.it-ebooks.info

noConflict method



#3. The jQuery namespace: noConflict method

Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery’s case,

$ is just an alias for jQuery, so all functionality is available without using $. If we need to use another

JavaScript library alongside jQuery, we can return control of $ back to the other library with a call to

$.noConflict:







This technique is especially effective in conjunction with the .ready method’s ability to alias

the jQuery object, as within a callback passed to .ready we can use $ if we wish without fear of

conflicts later:









You’ll only need to use this if you plan to use other JavaScript libraries that use the $ as a reference. You

will not need this if you are only using jQuery on your page. Even if you include several plug-ins, you will

not need this.



452   appendix i



www.it-ebooks.info

leftovers



#4. Debugging your jQuery code

It is always useful to debug your code—especially if you’re working on a large-scale project, with

many different types of objects, includes, or APIs. Oftentimes, you’ll need to know the content of an

object or variable sent back to you, but don’t want to alert it out, or figure out how to get at all the

properties of an object.

Enter some debugging plug-ins. These can help you look inside your objects so you can see when

their properties change values, or track the changes of a variable over time. You can also see how it

evolves throughout your application, or if it ever gets null values unintentionally. This can be very

useful when you’re troubleshooting JavaScript or jQuery code.

Two of the debugging plug-ins we’ve found useful when coding in JavaScript and jQuery are Dump

and VariableDebugger.

http://plugins.jquery.com/project/Dump (For seeing what your object contains.)

http://plugins.jquery.com/project/VariableDebugger (Similar, but displays info in pop up.)

There are several others, and there will be more and more over time, as well as improvements to

these. We found these useful, but to look for some more that you might like better, go to the jQuery

Plug-ins site (http://plugins.jquery.com/) and search for “debug.”

Of course, for everything else, there’s always the browser tools we’ve been using throughout the

book.



you are here 4   453



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

#1. Every single thing in the jQuery library

Tải bản đầy đủ ngay(0 tr)

×