4. • Created in March 2012
• Coordinates jQuery team work
o Code
o Documentation
o Infrastructure
o Events
The jQuery Foundation
5. • A non-profit organization
• Funded by
o Conferences
o Donations
o Memberships
o YOU or your company can be a member
http://jquery.org/join
The jQuery Foundation Is...
8. • http://github.com/jquery
• jQuery Core, UI, Mobile
• Sizzle selector engine
• QUnit unit test framework
• jQuery Migrate plugin
• TestSwarm CI testing
• Documentation sites
jQuery Foundation Projects
9. • jQuery 1.x vs. 2.x
o jQuery 1.x still supports IE 6/7/8
o jQuery 2.x supports modern browsers
o The two versions stay in API sync
o Both are maintained by the team
• Heavily publicized changes in 2012
• Several public betas
The jQuery Core Plan
10. • Released jQuery 1.9 in January
• Released jQuery 2.0 in April
All good? Great!
11. • Released jQuery 1.9 in January
• Released jQuery 2.0 in April
All good? Great!
12. Far too many people
are using "latest"
versions in live sites!
NEVER HOTLINK:
http://code.jquery.com/jquery-latest.js
http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js
What We Learned (the Hard
Way)
14. • Identifies things your code is doing that
jQuery 1.9+ don't support anymore
• Actually makes older code work
• Lets you use jQuery 1.9+ with code that
hasn't been upgraded yet
jQuery Migrate Plugin
20. • Usually not the best inference
• Often assumes future browsers and
versions will be broken the same way
• Horribly misused and misunderstood
Why $.browser Deserves To Go
21. Opera has announced their future
products will be based on the WebKit
engine, not their own Presto engine.
Browser Name is Only a BRAND
22. • IE can emulate older versions via<meta
name="X-UA-Compatible">
• IE11 betas don't even have "MSIE" in their
user agent string!
Internet Explorer's Disguises
The Enemy!
23. • It's like global variables, but for events
• Every event that occurs must bubble to
document before it can be processed
• Processing events can be expensive,
especially on deep documents
• Still easy to process events globally:
o $(document).on("click", "a", linkyClicky);
What's Wrong With .live()?
24. • Doesn't work well on iPhone/iPad!
• iOS doesn't bubble touch events all the
way to document
• Delegated touch events must be
processed below the <body> element
Letting all events bubble to document
destroys the usefulness of the event
propagation model
What's Wrong With .live()?
25. Original line:
$(".dialog .close").live("click", ...
Direct replacement (poor):
$(document).on("click", ".dialog .close" ...
Optimized replacement:
$(".dialog").on("click", ".close", ...
Optimize Your Selectors
26. The Bug:
• Before 1.9, $.parseJSON("") returned
null but it's not valid JSON
The Fix:
• In 1.9, $.parseJSON("") is an error
Fixing bugs is dangerous
business
27. • We called invalid JSON invalid.
• We're also out of coffee.
The Result: PANIC
28. In jQuery, every change is
a breaking change for
some poor developer.
The Moral of the Story
29. • Several modules can be excluded
• Bare-bones selector engine option
o Basically, just querySelectorAll
• How small?
o Normal build: 28KB
o Tiniest build: 14KB
• Smaller builds to come
o Option to exclude more code
o Finer granularity
Custom builds for smaller size
32. • Relatively minor changes from 1.9
• Brings 1.x into alignment with 2.x line
• Simplifies cross-version comparisons
o 1.10 --> 2.0
o 1.11 --> 2.1
o 1.12 --> 2.2
• Patch versions not always the same
o e.g. 1.10.1 and 2.0.2
jQuery 1.10
33. • The jQuery team supports both 1.x and
2.x; there isn't a problem of using an
"unsupported version"
• Since 1.x/2.x APIs are the same, there is
no problem in using 1.x exclusively on a
public web site -- it's recommended
Which version to use?
34. • Chrome or Firefox plugins
• node.js apps (jsdom, Cheerio)
• Windows 8 Store ("Modern/Metro") apps
• PhoneGap (iPhone/Android/BlackBerry)
• Apps using UIWebKit or WebBrowser
jQuery 2.0 is a good fit for