I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft’s official opinion of the spec. Subsections not listed below were read without comment.
Currently reading in 22.214.171.124 Embedding custom non-visible data with the data-* attributes
“ A custom data attribute is an attribute in no namespace whose name starts with the string ‘data-’, has at least one character after the hyphen, is XML-compatible, and contains no uppercase ASCII letters.”
There is an
element.dataset object that contains an element’s data- attributes (name-value pairs). Hyphenated data attributes become camelCase in the returned object.
The algorithms that manipulate the data attributes or their content basically undo all the work that the user agent does in creating the dataset object (insert “data-“ back in, convert back to hyphenation from camelCase).