views:

188

answers:

2

Ok, don't get me wrong, I absolutely love the idea of web standards... wrote and validated a number of pages with strict XHTML 1.0 - however, the web is evolving... and the more I use XML, realize the capacity of the DOM, and realize most browsers don't care one way or the other, the more I realize I realize I just want to break conventions and start using custom attributes.

Example of this is on my current site which uses a "message" attribute on a number of elements, and jQuery to then match those element types and update a footer message (something like a static tooltip). Problem of course is... this isn't actually supported.

My question then is simply is there something of a broader spectrumed doctype that would allow me to use 99% of the XHTML and/or HTML5 standard but throw in some custom attributes?

Or do I just continue to break validation and say to hell with it cause the browser and javascript will "get it" anyway?

+2  A: 

The nature of DTDs and XML validation requires that a custom DTD be used if you're adding extra namespaces to a document. See the A List Apart articles Validating a Custom DTD and More About Custom DTDs for details on how to create a custom DTD. I don't know if this is possible within the confines of DTD syntax, but you could consider creating your own namespace and simply declaring "this namespace may contain anything" -- that should provide a nice dumping-ground for custom data without interfering with XHTML parsing.

John Millikin
+2  A: 

If you're interested in HTML5, then make sure the names of your custom attributes start with "data-" and they'll validate in an HTML5 validator.

Otherwise, I'd just break validation. XHTML 1.x validation (which is doctype based) and browser interpretation of the markup (which is content-type based) are far enough apart to make XHTML validation of dubious value, once you know what you're doing.

Alohci