jQuery Conference: San Francisco Bay Area 2011

Table of Contents

1. Overview

  • Mobile web development (including testing and performance) continues to be a top priority.
  • JavaScript templating continued to get attention: Handlebars, mustache, underscore, and jQuery templates all were considered particularly in the context of client-side MVC frameworks.
  • Separation of the underlying object representation from the DOM is essential for the maintainability of the system. jQuery-driven applications can quickly lose structure given the heavy coupling between the DOM and objects.
  • MVC and data-binding will be increasingly important in the next six months as a way to ensure maintainability. $.databind() and Backbone.js were featured.
  • Testing seemed to move away from unit testing more toward BDD (likely reflecting the Rails influence) and JavaScript analysis tools.
  • The best sessions seemed to be those that focused on the strategic view of front-end engineering: better architecture, consolidated tooling, and browser support policies that consider the entire cost of a product rather than just presentation outside of context.
  • The metaphors we use to describe the role should not continue to be print but ought move to one that internalizes the concept of device capabilities: television.

2. Sessions

2.1. Day 1: April 16

2.1.1. 10:00AM: jQuery Keynote, John Resig

The state of the jQuery project in 2011. Covers details regarding jQuery core, jQuery mobile, and the project as a whole.

2.1.1.2. Mobile versions of the conference: aknosis.com

#jqcon for Twitter, @jqcon

Look at jQuery UI Grid; under active development and the most requested UI component.

2.1.1.4. .attr() updates
2.1.1.5. .prop() updates

This switches to use getAttribute by default rather than an "expando" such as input.type (as used by id)

2.1.1.12. Relative .css()

.css("height", "+10px") instead of dimension the height.

2.1.1.13. jQuery Mobile is in ongoing beta

The baseline for suport is a check if media queries are supported.

Will use pushState().

2.1.2. 11:30AM: jQuery Mobile, Todd Parker and Scott Jehl

jQuery Mobile Team Design and Dev leads Todd Parker and Scott Jehl will discuss the challenges and philosophy of the jQuery Mobile Framework, and how to use it to create websites and apps that provide a cohesive, touch-optimized experience in the latest mobile browsers while maintaining universal accessibility in older and under-featured browsers, and for users of assistive technology. Todd and Scott will also bring us up to speed with recent developments in the jQuery Mobile framework and its roadmap for future releases and features.

2.1.2.1. Still Alpha
2.1.2.9. Cleaner URLs with history.pushState()

This would allow full resolution of test.html#/product.html could /product.html

2.1.2.10. Move toward better JSON driven pages

Currently mostly document driven. Some of the work is on consolidating the Ajax calls or JSON + templates.

2.1.2.12. Using jQuery Mobile

2.1.3. 1:30PM: Mobile Performance, Steve Souders

Before Firebug existed it was hard to know what the browser was doing with your web page. Firebug (and more recent tools like dynaTrace Ajax Edition, Speed Tracer, Web Inspector, and HttpWatch) let us see how HTTP, JavaScript, CSS, the DOM, and rendering take up time as the user waits for the page to load. This visibility into browser performance has generated many web performance best practices as captured in tools like YSlow and Page Speed. The performance evolution that took place on the desktop (tools and research resulting in best practices) is starting in mobile. Right now we’re at step 1: gaining visibility into what’s happening in the mobile browser. Without this visibility, mobile web developers are flying blind. In this session Steve Souders shows how to analyze mobile performance across all the popular devices. He demonstrates analysis tools, services for accessing devices remotely, and quirks he’s discovered that show mobile performance is full of surprises.

http://stevesouders.com/docs/jqcon-20110416.pptx

2.1.3.4. WPO based companies

Evangelical approach to defining Web Performance Optimiation (WPO).

2.1.3.7. Tool: pcapperf

http://calendar.perfplanet.com/2010/mobile-performance-analysis-using-pcapperf/

This would be used in conjunction with Wire Shark or tcpdump.

This is converted to HAR from pcapperf.appspot.com

2.1.3.9. Tool: JDrop
2.1.3.10. Save files saved in local storage then just inline

Used by Google and Bing. Use the Storager application.

2.1.3.11. HTTP Archive

http://httparchive.org/

Show how trending occurs for HTTP requests not just the final page.

http://httparchive.org/viewsite.php?pageid=64769

2.1.4. 2:30PM: Progressive Enhancement 2.0 - Because the Web isn't Print, Nicholas Zakas

In the beginning, progressive enhancement was simple: HTML layered with CSS layered with JavaScript. That worked fine when there were two browsers, but in today's world of multiple devices and multiple browsers, it's time for a progressive enhancement reboot. At the core is the understanding that the web is not print - the same rules don't apply. As developers and consumers we've been fooled into thinking about print paradigms for too long. In this talk, you'll learn just how different the web is and how the evolution of progressive enhancement can lead to better user experiences as well as happier developers and users.

2.1.4.1. Meta

Internal jokes for the community.

  • Keep Paul Irish away from your mom.
  • @raybango if you don't like the talk
  • Doesn't know jQuery
2.1.4.2. Browsers History

Browsers and how to get the newest features.

  • Mosaic
  • Netscape 1
  • Netscape 2
  • Netscape 3: Now has color
  • MSIE 3

Thus started the browser wars…

2.1.4.3. 1998: Policy: Browser Wars: "Best Viewed In"

Show a button for upgrading.

2.1.4.4. 2000: Policy: Graceful Degredation

Browser sniffing or check for functionality.

<noscript>

Testing is based on the idea that things shouldn't break so you still need a support matrix.

2.1.4.5. 2007: Policy: Progressive Enhancement

Naked CSS day. Use semantic markup.

See the division between content, presention, client-side scripting.

But is this a standard nomenclature.

Yahoo! Graded Browser support is based on progressive enhancement. Assume you define the level of the view.

2.1.4.6. Origin analysis: find a metaphor for a page

The problem came in because we (business and developers) though we understood what a "page" was supposed to be.

All books look the same.

2.1.4.10. Use stacked layers of JavaScript and CSS features

But this creates a testing nightmare if it needs to be fully supported.

But this might be the wrong goal.

2.1.4.11. Need to find what the easy things to do that have value

Historically we've spent a massive amount of time supporting IE6 / IE7 for pixel perfect rendering.

2.1.4.12. Rounded Corners: only implement with CSS

Image, sprite, position, CDN, need to update. This isn't a worthwhile use of resources.

2.1.5. 3:30PM: Integrating Code Quality tools into your jQuery Development Workflow, Anton Kovalyov (#2)

JavaScript is a very powerful and flexible language that allows you to write very elegant programs. However, it has some parts of it that are easily breakable and no matter what you are writing, new jQuery plugin or nice interface for your web application, it is very important to not to ship broken code. Fortunately, there are tools that were designed to catch potential problems in your code and report about them before the deployment of your code.

This talk is about integrating such tools into your daily development workflow. It will give you basic idea of problems that JavaScript has and approaches you can take to prevent those problems. It will also cover JSHint — a community-driven code quality tool — and how we use it at Disqus to make sure that we don't ship broken code to 400m+ visitors.

2.1.5.1. History

Browser wars -> DOM issues. Incompatibilities in the DOM0 vs. DOM2…switching between trivial selection mechanism (e.g., document.all vs. getElement{sByTagName, sClassName, ById}) made non-trivial applications impossible.

2.1.5.2. What is the value of a safe subset of the language

Should coerction be used for null or undefined; does jQuery do the right thing?

2.1.5.3. Standard mistakes: function hosting and closure

Example was a test with a function defined in a conditional that is hoisted to the top of the scope.

The second was a function defined in a for loop with returned values.

2.1.5.5. Use: Detecting globals

Either run in strict mode to detect incorrect use of this as the global object (window).

2.1.5.6. Tooling: Git hooks

Install as a git hook; scripts are available in github.

git -n

skips all of the hooks.

2.1.6. 4:15PM: Getting Truth Out of the DOM, Yehuda Katz (#2)

"How do I build larger applications using jQuery?" It's a question that starts to creep into the minds of virtually every jQuery developer after building one or two non-trivial web applications. There are many good answers to this question, and even some talks at this conference that describe ways to use code organization and other techniques to help scale applications.

http://dl.dropbox.com/u/2285145/Getting%20Truth%20Out%20of%20the%20DOM.pdf

2.1.6.1. What happens when you start getting big

Fighting against the file size issue.

Also fighting against the desire to build the solutions that match to the particular project.

Would need to have the abstractions done as a larger projects.

What happens in the lifecycle of a project.

2.1.6.2. Traditional jQuery setup

event -> [Handler] -> DOM update

2.1.6.3. Custom event setup

event -> native handler -> [Custom event]

custome event -> [Handler]

Event simulation becomes the issue since you still need to find the underlying object.

2.1.6.4. Data Centric Approach

Within the last two years. Most of the underlying work done in data and events.

Uses property observing library. Need to wrap to check that the update won't self trigger.

Example provides is for todo:

var ToDo = function() {} ToDo.prototype.set …

Uses a model as part of an underlying object. Set properties then look up the underlying DOM representation.

2.1.6.6. Revised Data Centric Approach

event -> native -> update data data event -> native -> update DOM

This could work with Backbone or $.data() event listeners.

  • Todo item has state isDone = false
  • item state changes to true
  • List changes by removing the item
  • Update the number of items

This lives by looking at a changeData event handler when using $.data().

2.1.6.7. Data Cetric Approach performance

This occurs only when there isn't a 1 to 1 map between data and DOM state.

  • native change handler
  • set is done on object
  • object change handler
  • recalcuate

This all cascade and the tasks are repeated.

2.1.6.8. Work around with bulk transactions

List now begins to have bulk property to true for the update.

This is very similar to the logic used for the layout calculation system used in rendering engines.

2.1.6.9. Observers can fail with bulk/queued activities

Example is deleting all contacts. Does this flag an updater state?

2.1.6.10. Example: triggerLater
  • start native handler
  • triggerLater calls
  • end native
  • triggerLater starts
2.1.6.11. Truth in DOM vs. Truth in Model

Examples: New Twitter, GitHub issue handler, WordPress comment management.

Each requires that a single interaction will push to many other UI elements in the DOM.

  • Have a list of four
  • Check clear all
  • Add new events -> uncheck clear all
  • Delete new event -> check clear all?
2.1.6.12. SC MVC: Declarative Bindings

Focus on what a function like allAreDone actually means.

Binding occurs in the template back to the model that is used to define what the data means for the system.

Key property is the notion of "dirty" based on changed that are made or dependencies changed that aren't reflect in DOM.

2.1.6.13. Property Observing systems and Handlebars.js

How close is this to the goal of having a JSON structure poured into the template that defers rendering to the point where the underlying model is effectively complete and we no longer have active "dirty" work happening?

Not that close. You still need a property observing libraries which means you need to handle intermediate state.

Reality gets reflected in the DOM…

2.1.6.14. TODO amber.js

http://blog.sproutcore.com/post/3075780393/sproutcore-amber-a-report-by-yehuda

Runtime: Handlebars, jQuery eventing, templates

http://amber-todos.strobeapp.com

Uses boilerplate as well.

2.1.7. 5:15PM: Prototyping and Unit Testing with Mockjax & mockJSON, Elijah Manor (#2)

The front-end and back-end of your application inevitably progress at different speeds. In order for each layer to develop independently it is optimal if the front-end piece can work regardless of the back-end, which is where the Mockjax plugin comes in. Mockjax can intercept and simulate ajax requests made with jQuery with minimal effort and impact to your code. Another tool that works well with Mockjax is mockJSON which provides a random data templating feature. This can be very handy when you want to mock a JSON response from a AJAX call, but instead of manually building the response you can build a template to do it for you.

2.1.7.1. MockJax

http://enterprisejquery.com/2010/07/mock-your-ajax-requests-with-mockjax-for-rapid-development/

Includes a latency option as well.

Mock is just defined as part of a test configuration.

2.1.7.3. Amplify

Create routes and JSON constructors.

Can override Amplify definitions of the resource -> URL mapping needed for the mock data.

Has decoder functions when using external live data instead of mockJSON.

2.2. Day 2: April 17

2.2.5. 2:45PM: Sneaking structure into your DOM-based application, Garann Means (#2)

2.2.5.1. Be wary of data embedded in DOM that isn't necessary.

The key area would be JavaScript values in option values: page weight with odd selection rules and limited inspection.

2.2.5.2. Don't need to namespace all widgets under $

Keeps the jQuery object clean. Comes at a cost of not binding to site functionality.

2.2.5.3. Move to pub/sub
2.2.5.4. Reduce anonymous function

jwalsh.event.publish("search.loaded") jwalsh.event.subscribe("search.loaded)

jwalsh.event.publish("page.changed", 5)

2.2.5.5. Focus on the jQuery version updates

Limited prediction capabilities.

2.2.8. 5:30PM: Understanding jQuery Events, and working new HTML5 APIs, Boaz Sender

2.2.8.2. jQuery doesn't provide access to new HTML elements

These are synthetic events.

2.2.8.3. event.originalEvent has more than one would think

Look at all of the e.original events for click that aren't in the jQuery event.

original event: … extra props: []

2.2.8.4. New HTML5 Events

Now shortcut methods for new events.

  1. haschange
  2. popstate

    Fired when the history state changes.

  3. message

    event.originalEvent.{data, source}

  4. drop (used with fileReader from File API)

    Creaete a drop-zone.

  5. timeupdate

    $(this.get(0),currentTime

  6. MozAudioAvailable

    $('#audio').bind('timeupdate', function() { console.log(event.originalEvent.frameBuffer) });

    This would allow for visualization of the frame buffers.

2.2.8.5. jQuery.event.props

$.event.props ["altKey", "attrChange", "attrName", "bubbles", "button", "cancelable", "charCode", "clientX", "clientY", "ctrlKey", "currentTarget", "data", "detail", "eventPhase", "fromElement", "handler", "keyCode", "layerX", "layerY", "metaKey", "newValue", "offsetX", "offsetY", "originalTarget", "pageX", "pageY", "prevValue", "relatedNode", "relatedTarget", "screenX", "screenY", "shiftKey", "srcElement", "target", "toElement", "view", "wheelDelta", "which"]

3. Tasks

3.1. TODO Archive performance results

I have the three performance runs from Web Page Test

The original site scores from the mock version would also be available.

04/14/11 13:36:44 Dulles, VA - IE7 - DSL (video) http://www.classmates.com 04/12/11 16:56:04 Dulles, VA - IE8 dynaTrace - DSL http://www.classmates.com 04/11/11 15:44:46 Dulles, VA - IE7 - DSL http://www.classmates.com 04/08/11 15:04:34 Dulles, VA - IE7 - DSL (video) http://www.classmates.com/ 04/08/11 15:01:04 Dulles, VA - IE8 - DSL (video) http://www.classmates.com/ 04/08/11 14:13:33 Dulles, VA - IE8 - DSL (video) http://www.classmates.com/ 04/07/11 11:53:24 Dulles, VA - IE8 - DSL ML:Home:56k http://www.classmates.com/ 04/07/11 11:25:02 Dulles, VA - IE8 dynaTrace - DSL http://www.classmates.com 04/07/11 11:22:55 Dulles, VA - IE7 - DSL (video) ML:Yearbooks http://www.classmates.com/yearbooks/? 04/07/11 11:22:55 Dulles, VA - IE7 - DSL (video) ML:Video http://www.classmates.com/feature/video… 04/07/11 11:22:54 Dulles, VA - IE7 - DSL (video) ML:Home http://www.classmates.com 03/17/11 15:08:24 Dulles, VA - IE7 - DSL http://www.classmates.com 03/15/11 13:47:14 Dulles, VA - IE7 - DSL http://classmates.com

3.4. TODO Prototype a property observers system

Get resources dedicated to derive a concensus of the approach to take for architecture.

3.9. Do shims and polyfills waste developer time

Look at the different.