Top Banner
State of jQuery Fall 2010 John Resig
51

John Resig Beijing 2010 (English Version)

Jan 15, 2015

Download

Technology

Jia Mi

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: John Resig Beijing 2010 (English Version)

State of jQueryFall 2010

John Resig

Page 2: John Resig Beijing 2010 (English Version)

State of the Project

Page 3: John Resig Beijing 2010 (English Version)
Page 4: John Resig Beijing 2010 (English Version)
Page 5: John Resig Beijing 2010 (English Version)

New Releases

• jQuery 1.4.3 / jQuery 1.4.4

• Official Plugins:

• jQuery Templating

• jQuery Data Linking

• jQuery Mobile

Page 6: John Resig Beijing 2010 (English Version)

jQuery 1.4.3

• JSLint

• Modularity

• CSS

• Traversal Performance

• HTML 5 Data

Page 7: John Resig Beijing 2010 (English Version)

JSLint

• Tool written by Douglas Crockford

• Do some basic validity checks on JavaScript

• With more commits coming in, helps to enforce basic style guidelines

• Completely integrated into our development workflow: make lint

Page 8: John Resig Beijing 2010 (English Version)

Modularity

• All jQuery modules can now be individually loaded.

• Could use a script loader to load each file separately.

• Allows us to avoid building jQuery to run the test suite.

Page 9: John Resig Beijing 2010 (English Version)

CSS

• Massive rewrite of the CSS module.

• Focus on extensibility.

• (A bit of performance too!)

• Plugins already using it: jQuery Rotate

Page 10: John Resig Beijing 2010 (English Version)
Page 11: John Resig Beijing 2010 (English Version)

0

100

200

300

400

Firefox 3.6Firefox 4b7 Chrome Safari 5 Opera 10.6 IE 6 IE 7 IE 8 IE 9b1.4.3 1.4.2

jQuery 1.4.3 .css() Get(Time in milliseconds - lower is better)

Page 12: John Resig Beijing 2010 (English Version)

Traversal Performance

Page 13: John Resig Beijing 2010 (English Version)

0

1000

2000

3000

4000

Firefox 3.6 Firefox 4b7 Chrome Safari 5 IE 9b1.4.3 1.4.2

jQuery1.4.3 .closest()(Time in milliseconds - lower is better)

Page 14: John Resig Beijing 2010 (English Version)

0

100

200

300

400

Firefox 3.6 Firefox 4b7 Chrome Safari 5 IE 9b1.4.3 1.4.2

jQuery1.4.3 .filter() Single(Time in milliseconds - lower is better)

Page 15: John Resig Beijing 2010 (English Version)

0

750

1500

2250

3000

Firefox 3.6 Firefox 4b7 Chrome Safari 5 Opera 10.6 IE 8 IE 9b1.4.3 1.4.2

jQuery1.4.3 Elem .find()(Time in milliseconds - lower is better)

Page 16: John Resig Beijing 2010 (English Version)

HTML 5 Data

• HTML 5 has this new concept of data- attributes.

• <div data-role=”page”></div>

• You can give them any name, it doesn’t matter, your page will validate.

• We added support for this in 1.4.3.

Page 17: John Resig Beijing 2010 (English Version)

data- Attributes

• For example:

• <div data-role=”page”></div>

• $(“div”).data(“role”) === “page”

Page 18: John Resig Beijing 2010 (English Version)

data- Attributes

• Also handles JSON encoding correctly.

• For example:

• <div data-hidden=”true”></div>

• $(“div”).data(“hidden”) === true

Page 19: John Resig Beijing 2010 (English Version)

jQuery 1.4.4

• Fixed a number of bugs.

• Added a couple of features:

• .fadeToggle()

• Bulk .data() data attribute import

Page 20: John Resig Beijing 2010 (English Version)

Bulk .data() Import

• <div data-role=”page” data-max=”3”></div>

• $(“div”).data() -->

• { role: “page”, max: 3 }

Page 21: John Resig Beijing 2010 (English Version)

Data Linking

• Sync forms live with JavaScript objects.

• Dramatically simplify the process of extracting data from a form and updating it.

• Another plugin developed in conjunction with devs at Microsoft.

• http://github.com/jquery/jquery-datalink

Page 22: John Resig Beijing 2010 (English Version)
Page 23: John Resig Beijing 2010 (English Version)
Page 24: John Resig Beijing 2010 (English Version)

Templating

• New official templating plugin.

• Provide a simple way of putting data into an HTML string.

• Developed in conjunction with devs at Microsoft.

• http://github.com/jquery/jquery-tmpl

Page 25: John Resig Beijing 2010 (English Version)
Page 26: John Resig Beijing 2010 (English Version)
Page 27: John Resig Beijing 2010 (English Version)

Fall 2010

jQuery MobileJohn Resig

Page 28: John Resig Beijing 2010 (English Version)

I’ve been researching and trying to makesense of the mobile space recently.

Started preparations in 2009 (with the creation of TestSwarm).

Page 29: John Resig Beijing 2010 (English Version)

Cross-browser mobile web development is crazy.(...but not nearly as crazy as it use to be.)

Page 30: John Resig Beijing 2010 (English Version)

A Simple Goal

✤ Started with a simple goal:

✤ To make sure that jQuery works on the most popular mobile platforms and browsers.

✤ As it turns out, it’s really hard to define the scope of the problem.

Page 31: John Resig Beijing 2010 (English Version)

Questions: Answered

✤ Three questions that need to be answered before doing mobile development:

✤ What platforms and browsers are popular?

✤ What browsers are capable of supporting modern scripting?

✤ What devices and simulators do I acquire to test with?

✤ To answer those questions we need good data.

Page 32: John Resig Beijing 2010 (English Version)

Best Stats?

✤ Who has the best statistics on the mobile market?

✤ StatCounter and Gartner seem to be tops.

✤ StatCounter covers billions of hits per month.

✤ Gartner is well-respected and knows sale information well.

✤ AdMob is decent for specific platforms (iPhone, Android).

✤ That being said: Very little actually-useful information leaks out.

Page 33: John Resig Beijing 2010 (English Version)

Lack of Information

✤ Right now finding this information is a challenge.

✤ As a result, developers develop for what’s in front of them:

Page 34: John Resig Beijing 2010 (English Version)

Platforms

Page 35: John Resig Beijing 2010 (English Version)

Platform Sales

Page 36: John Resig Beijing 2010 (English Version)

Hard Question

✤ What versions of those platforms are popular?

✤ No one seems to know, or isn’t talking about it.

Page 37: John Resig Beijing 2010 (English Version)

Browsers

Page 38: John Resig Beijing 2010 (English Version)

Hard Question

✤ What versions of those browsers are popular?

✤ No one seems to know, or isn’t talking about it.

✤ Supposedly Yahoo is going to be releasing some information soon, we’ll see.

✤ Right now it’s considered to be a competitive advantage to keep it private.

Page 39: John Resig Beijing 2010 (English Version)

Testing Strategy

✤ Draw a line in the sand

✤ Buy Devices, Download Simulators

✤ Automate testing (TestSwarm!)

Page 40: John Resig Beijing 2010 (English Version)

Drawing a Line

✤ Yahoo!s Graded Browser Support technique is optimal.

✤ Qualify which browsers you will support (actively test against) and give them a grade.

✤ A = Full support, C = Fall back to old site, Other = Assume full support.

Page 41: John Resig Beijing 2010 (English Version)
Page 42: John Resig Beijing 2010 (English Version)

Mobile Graded Browser Support: Market share + Browser quality

Page 43: John Resig Beijing 2010 (English Version)

Testing Browsers

✤ Two options:

✤ Buy devices and/or

✤ Download simulators

✤ Simulators are good for most automated testing.

✤ Any sort of interaction testing you’ll want to do on a physical device.

✤ Always good to do a sanity check on a physical device before going live.

Page 44: John Resig Beijing 2010 (English Version)

Simulators

✤ Simulators are available for most platforms and browsers.

✤ Most simulators require Windows to run (some require Perl or Java)

✤ Some browsers even provide standalone executables (Opera, Fennec).

✤ Getting the simulators running can be a real bear.

Page 45: John Resig Beijing 2010 (English Version)

Automated Testing

✤ Once you have simulators (or physical devices) up and running you’ll want to interact with them as little as possible.

✤ Automated test execution will be really important.

✤ TestSwarm was developed for this express purpose: Make it easy to push tests out to a large number of clients (even mobile).

Page 46: John Resig Beijing 2010 (English Version)

The Missing Gap

• Almost all mobile web development focuses on modern WebKit

• There are far too many other platforms

• Blackberry, Opera, Windows Mobile, Mobile Firefox, Symbian, etc.

• jQuery Mobile works everywhere - and without sacrificing experience.

Page 47: John Resig Beijing 2010 (English Version)

Phase 1: jQuery Core

• We’re working to make jQuery core work on all the popular mobile browsers.

• Building out our test suite and continuous integration testing.

• Using TestSwarm to automate our testing across all platforms.

• Fixing mobile bugs in core.

Page 48: John Resig Beijing 2010 (English Version)

Phase 2: jQuery Mobile

• A complete framework for building mobile web sites and applications.

• Provide all the widgets and layout components necessary to build mobile sites.

• Built on the principles of progressive enhancement

Page 49: John Resig Beijing 2010 (English Version)

Question:

• How does jQuery Mobile compare to jQTouch or Sencha Touch?

• jQuery Mobile is all about progressive enhancement.

• Works on many more devices.

• Has a smaller file size (13KB)

Page 50: John Resig Beijing 2010 (English Version)

More Information

• More information:

• http://blog.jquery.com/(jQuery 1.4.3/1.4.4)

• http://jquerymobile.com/

Page 51: John Resig Beijing 2010 (English Version)

New!

• HTML 5

• Video

• Audio

• CSS 3

• WebGL