ded/bonzo — pull request #37 by rvagg (2011-10-17 05:18:40+00:00)
Title: tml5 data-* attributes for data()

Sorry for keeping this up, just adding/fixing things as I want them, I hope you don't mind and that this one meets your approval.

Extended `data()` to also read data-* attributes from elements as well as internal data storage. It's a one-way thing so they are not written back when set with `data(k, v)` (although that could change of course).

If a key doesn't exist in the internal store then see if it exists as an element data-* attribute, if it does then fetch it from there, put it in the store and return it. Basic conversion is done for booleans and numbers.

If `data()` is called without any arguments then it's interpreted as a 'get all data' and the whole store is returned; this also means fetching all data-* attributes on the element in one go and putting them into the store. So it can be used to turn all data-* attributes into an object which is mighty handy.

Mostly as per: http://dev.w3.org/html5/spec/elements.html#embedding-custom-non-visible-data-with-the-data-attributes

Tests included.