WARNING: there are experimental elements and deeply controversial syntaxes ahead! Proceed at your own peril! You have been warned, and the website you save…could be your own. Ten years ago, right here in ALA, a wild-eyed hell-raiser going by “PPK” made a radical proposal: custom attributes in markup.
Well, okay. At the time it was radical. Here in the future, we have perfectly valid HTML5
data- attributes to contain all manner of information and act as behavioral triggers for our scripts.
All of this holds as true today as it did a decade ago. I know I’ve used
data- attributes for both: to invoke custom behavior without touching the classes I use for styling—keeping my behavioral layers and presentation layers separate—and to pass relevant configuration information to said scripts. Picturefill 1’s
data-srcset="1x source.jpg, 2x hd-source.jpg" comes to mind: we could define an attribute and write a script that dictates how the associated element should behave, all in one perfectly valid package.
required? These custom attributes that once so daringly flew in the face of conventional web standards are now part of the HTML5 standard.
Maybe it’s best that the web didn’t linger too long on our warning at the top of the page.