Jquery introduce
Upcoming SlideShare
Loading in...5
×
 

Jquery introduce

on

  • 290 views

 

Statistics

Views

Total Views
290
Views on SlideShare
290
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Jquery introduce Jquery introduce Presentation Transcript

  • Fundamental ofjQueryZhouquan.yezqSenior Web Developer
  • Agenda• Selector• Array/Object• Event handing• Custom event• Deferred/promised
  • What find something, thenjQuery do some action does?
  • SelectorNative DOM Support jQuery SupportgetElementById $(‘#id’)getElementByTagName $(‘div’) elementgetElementsByName $(‘input*name=“myinput”+’) $(‘*’)…div.class1div .class1div > .class1http://www.w3.org/TR/CSS21/selector.html
  • Array/Object$.Each$.Map$.slice
  • Event Handing• Capturing• Bubblinghttp://www.quirksmode.org/js/events_order.html
  • W3C Model element1.addEventListener(click,doSomething2,true)jQuery ‘s delegate method and Backbone view Event use the bubble phase.
  • Custom Event$.trigger$(‘li’).on(‘mycustomevent’,function(){ //todo})$(‘li’).trigger(‘mycustomevent’);Our pub/sub method idea come from here
  • 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