html5 - Why no data-* elements? -


this question satisfy curiosity: growth , acceptance of larger javascript frameworks last, say, 5 years, has become increasingly common have attributes on elements add custom behavior known html elements. reason html5 introduces data-* attributes, every tool, including browser parsing dom actively ignores while rendering key js framework enrich html full-fledged application platform.

with angular directives (for example), app builders enrich html whole adding ability create custom elements. thing however, editing tools, visual studio, break, since actively check if html elements add exist.

now, question not visual studio (i know how disable html validation), why did creators of html5 standard never considered include data-* elements well? or maybe did, , idea discarded somehow. know?

the data- prefix part of html5 draft

these attributes semantic html; example, attaching database id html element html parsers can use data. in case of angular, custom attributes not carry data; extend html.

mozilla has guidelines on topic of data prefix: https://developer.mozilla.org/en-us/docs/web/guide/html/using_data_attributes

edit intent of html elements carry content displayed browser, attributes attach meta-data these elements , <head> attach meta-data whole document. there no data- elements in html it's consistent design.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -