Sunday, April 13, 2014

HTML 5 Data-* Attribute

Data-* attribute is special novelty in HTML 5 that can be used for own purposes.

For example, we can use our own data-author, data-title, data-text, data-car-model attributes (anything starting with data-) and it will be valid HTML. Custom data attribute can be used on any element:

<span data-author>Miguel de Cervantes Saavedra</span>
<span data-title>Don Quixote</span>


One of the big architecture flaw appears: there is no namespace!
And I predict there will be lots of conflicts, especially when one famous javascript framework will use same data- designation as another framework, or it will conflict with you own clear attribute names.
Microsoft already uses data-* attributes in ASP.NET MVC for validation.


No comments:

Post a Comment