According to HTML5 spec, every attribute that starts with data- should be ignored by browser and considered a data needed for some scripts. For example:

<ul data-sortable="yes">…</ul>

Does it remind you of something? It is a simplified version of XML namespaces, but limited to non-hierarchical data and with much more probability of data clash.

John Resig, in the comments to his blog post on the matter, says that “The learning curve and failure rate are too high to purely XML-based markup, which is why the data-* attribute exists as a means to implementing this solution”. I completely disagree with the learning curve argument, and this is why:

Programming is complex.

It is easy to forget about the complexity while doing smart new stuff. And new cool things is not what I am talking about. Inventing new thing is easy, since you do not have to think about all limitations of the new ones. Making them work for all occasions, that is what is complex.

It is easy to praise HTML5 over XHTML. It is easy to praise microformats.

But all standards are here for a reason. It is easy to punch Microsoft, however first versions of Google’s Picasa didn’t support non-English text in labels, at all. Current version of Adobe Buzzword does not support Russian text. Current versions of Picasa and Opera do not support Drag&Drop outside of application. I have never seen any of such problems in MS applications. In fact, Visual Basic supported Unicode for ages, while relatively modern web languages stumble on it.

I have already blogged about microformats being a hack. And now I read about BBC removing microformats support due to problems with screen readers and semantics of abbr tag. Is it easy to remember that screen readers must be supported? No. Is it a shiny 2.0 kind-of-thing to think about them? No. But it is one of the multiple things you have to think about when making a wide-used standard.

Adding easy solutions when possible is a great thing. But it wrong to think of programmers as people who can only work with easy solutions. Flexibility is much more important than ease of use, and that’s the lesson that produced, for example, ASP.NET MVC. Also, easy ways should exists as shortcuts for flexible ones, not be orthogonal to them.

And while HTML may be about design, and text processing, and other things, data-* is about programming.

  • http://graegert.com Steve

    Hmm, I believe you're mixing up several completely unrelated topics. X/HTML 5 is not for the programmer and therefore should be as simple as possible, even if it means mimicking XML functionality. The paragraphs about standards (language stuff) and ASP.NET MVC are completely unrelated to the X/HTML 5 debate. While data-* is about programming, you may want to ask yourself how many web designers are not programmers, nevertheless, writing awesome JavaScript code? data-* is made for them not primarily for programmers in its conventional perception.

    Additionally, I do not fully understand the last paragraph. What are you trying to say? What does ease of use have to do with ASP.NET MVC? It's a design pattern, not more. More importantly, it is something that exists in other languages for ages which MS thought of being completely unnecessary. MVC is neither an “easy solution” nor a “shortcut” of some kind.

  • http://blog.ashmind.com Andrey Shchekin

    People who write awesome JavaScript code _are_ programmers. Their job may be named 'designer', but it is a misnomer.
    If a person writes good JavaScript, then he is a JavaScript programmer, and people writing really good JavaScript have no problems understanding complex things — namespaces are a piece of cake compared to prototypes.

  • http://blog.ashmind.com Andrey Shchekin

    ASP.NET was a solution was expected to be 'simple for developers'. Just drag&drop some things and get the work done.
    That worked, to some extent. In the same way the data-* would work, as long as the task is not complex enough.

    ASP.NET MVC is the flexible solution. For some people, it might not be as easy to use or understand as original ASP.NET.
    However flexibility has proven to be very important, important enough for Microsoft to spend time and resources to develop it.
    Would the original ASP.NET be created, if Microsoft started with ASP.NET MVC? I am not sure.

  • http://ln.hixie.ch Ian Hickson

    Eugenics aims to solve merely one: the devolution of our civilisation. That this is happening, and that it is a logical outcome of the egalitarian “political correctness” that our society is obsessed with, is a verifiable fact.

  • http://ln.hixie.ch Ian Hickson

    Eugenics aims to solve merely one: the devolution of our civilisation. That this is happening, and that it is a logical outcome of the egalitarian “political correctness” that our society is obsessed with, is a verifiable fact.

  • http://ln.hixie.ch Ian Hickson

    Eugenics aims to solve merely one: the devolution of our civilisation. That this is happening, and that it is a logical outcome of the egalitarian “political correctness” that our society is obsessed with, is a verifiable fact.