Well, I must admit it. Now I really confused, I was validating the XHTML output of the pages of our current project, and because we used some custom attributes to create some widgets using a combination of Javascript and HTML (a custom attribute is an attribute that is not part of the HTML or XHTML specifications, like in <div id=”dialog” custom_type=”dialog”>, the custom attribute is “custom_type”), I realize the pages will fail the validation process, and as I was suspecting they did, they fail. But I remember that a big and popular Javascript toolkit uses custom attributes too, so, I think, mmm, “let’s look how they did to make their html output be valid XHTML”, and what I found has confused me a lot.
Dojo does not produce valid XHTML, they remove the Dojo namespace from their markup, so their pages don’t validate anymore (http://dojotoolkit.org/book/dojo-porting-guide-0-4-x-0-9/widgets/general). Why? I don’t really understand why?, I really want to know it.
Well, I think they’re tired of the war: “The Parser” posts this:
[...]
There's a big religious war about whether pages validating or not is important and I don't want to beat that dead horse anymore.
[...]
Lucky me, Dojo was not my favorite Javascript toolkit, and in my current project I am not using it, I am using JQuery (Dojo fans, sorry, if you need to make your code valid, as far as I know, you will have to make changes to the parser!!).
But, what can I do now? Do I must forget about Validation issues?
Well I was looking deeper and I found a really nice post from Jonh Resig http://ejohn.org/blog/html-5-data-attributes/
It seems that HTML 5 (http://www.w3.org/html/wg/html5) includes some cool features!, like the data-attribute to declare custom attributes, so in the future, I will not have to deal with custom DTDs or custom XHTML Namespaces! (Namespaces are not used to validate XHTML, Thanks for the comment zcorpan!).
But, now I’m more confused! What should I do?.
Should I still try to make the pages validate or not?
Well I think I could use XHTML Namespaces to make it validate.(I will use the approach of the data-attribute in order to keep compatible with the HTML5 specification) So I will have to do some changes now. A little bit more of work, but at the end of the day I will feel better with myself. But seriously I’m already confused, because the future is not as clear as I was thinking... Ok, don’t you believe me? Take a look to these good articles:
http://xhtml.com/en/future/x-html-5-versus-xhtml-2/#x5
http://www.robertnyman.com/2007/02/05/html-5-or-xhtml-2/
Goodbye.
---
Take a look to this post too:
http://marcgrabanski.com/article/5-tips-for-better-jquery-code