Understanding jQuery's Data API's

jQuery's Core Team Member, Dave Methvin has a great write up on LearningjQuery.com called "Using jQuery's Data API".  He walks us through the beginning thoughts on what the .data() API was meant for, a DOM based In-Memory storage, to how it evolved into reading the data attribute in HTML5.  Dave outlines 5 rules of the road for using .data():

  1. Only the .data() API reads HTML5 data-* attributes, and it does so once.
  2. The .data() API converts HTML5 data-* values to Javascript types whenever possible.
  3. The lower-level jQuery.data() API does not read HTML5 data-* attributes.
  4. No jQuery data API ever changes HTML5 data-* attributes.
  5. All data-* names are stored in camelCase in the jQuery data object, using W3C rules.

You can read more about the history and the rules of the road over at Learning jQuery.