HTML 5 data- attributes
One welcome addition to the proposed HTML5 specification is to allow any attribute prefixed with data- to be treated as a storage area for private data. This makes it possible to associate private data with different DOM elements when a page is generated and sent from the server while still validating against an HTML validator.
Previously it has been possible to temporarily store state information in custom properties against an element via javascript, however embedding state information in a page when generated server-side (and getting a page to validate) always required workarounds. I’ve often resorted to using hidden input elements to expose state information to client-side script, but this should not (and won’t any longer) be necessary.

Comments
No comments yet.
Leave a comment