Your SlideShare is downloading. ×
  • Like
Jquery introduce
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Jquery introduce

  • 80 views
Published

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
80
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Fundamental ofjQueryZhouquan.yezqSenior Web Developer
  • 2. Agenda• Selector• Array/Object• Event handing• Custom event• Deferred/promised
  • 3. What find something, thenjQuery do some action does?
  • 4. SelectorNative DOM Support jQuery SupportgetElementById $(‘#id’)getElementByTagName $(‘div’) elementgetElementsByName $(‘input*name=“myinput”+’) $(‘*’)…div.class1div .class1div > .class1http://www.w3.org/TR/CSS21/selector.html
  • 5. Array/Object$.Each$.Map$.slice
  • 6. Event Handing• Capturing• Bubblinghttp://www.quirksmode.org/js/events_order.html
  • 7. W3C Model element1.addEventListener(click,doSomething2,true)jQuery ‘s delegate method and Backbone view Event use the bubble phase.
  • 8. Custom Event$.trigger$(‘li’).on(‘mycustomevent’,function(){ //todo})$(‘li’).trigger(‘mycustomevent’);Our pub/sub method idea come from here
  • 9. Deferred/Promised01: challenges with the Async programminghttp://blogs.msdn.com/b/ie/archive/2011/09/11/asynchronous-programming-in-javascript-with-promises.aspx02: jQuery$.ajax({ url: http://search.twitter.com/search.json, dataType: jsonp, data: { q: #IE10, rpp: 100 } }).success(function (data) { /* handle data */ }).error(function (error) { /* handle error */});03: How to make promised function