Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It’s explicitly part of the HTML spec that you can do this, and that the semantics of those attributes are application/user defined, and should not be interpreted by the browser.


Out of genuine curiosity, where's this defined? I went looking and could only find https://www.w3.org/TR/2011/WD-html5-20110405/Overview.html

> For flexibility, attributes names containing underscores (the U+005F LOW LINE character) are also reserved for experimental purposes and are guaranteed to never be formally added to the HTML language.

> Note: Pages that use such attributes are by definition non-conforming.

in a broader context of "experimental purposes" being for "vendor-specific proprietary user agent extensions to this specification", which "are strongly discouraged. Documents must not use such extensions, as doing so reduces interoperability and fragments the user base, allowing only users of specific user agents to access the content in question."

Is that it? That seems different, but I don't see anything else similar. Or am I looking in the wrong spec?

There's also https://html.spec.whatwg.org/#attribute-name-state which defines attribute names as not inclusive of underscores.


Not sure what parent post was referring to explicitly but data attributes were the first thing I thought of in this general context




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: