tags:

views:

537

answers:

1

I want to add some Dojo widgets to my XHTML pages, but Dojo uses some attributes that aren't part of the XHTML spec. For example:

<input dojoType="ComboBox" type="text" dataUrl="/some_data.json" />

The dojoType and dataUrl attributes cause validation problems. I believe Dojo lets me move dojoType into the class attribute:

<input class="dojo-ComboBox" type="text" dataUrl="/some_data.json" />

That solves part, but not all of the problem. The "correct" solution would look something like this:

<input dojo:type="ComboBox" type="text" dojo:dataUrl="/some_data.json" />

But that requires a Dojo XMLNS declaration at the top of my HTML file, which means I need to find a copy of the Dojo XMLNS DTD. I suspect I'll need to copy it to my server and host it there because I've extended the Dojo toolkit. Will Dojo even pick up on the scoped version?

+1  A: 

I don't believe substituting a custom DTD will make your pages validate. Whatever the DTD they are still not valid XHTML. If validation is really important you could try using the Dojo JavaScript library to write out all your widgets instead: http://www.dojoforum.com/node/1182 HTH

Ola Tuvesson
A List Apart disagrees (sort of): http://www.alistapart.com/articles/customdtd/ The document with multiple DTDs won't validate as XHTML, but it will validate against the enhanced, combined schema.
James A. Rosen
Sure, this really depends on what you mean with validation though. If you mean "parse my pages with the DTD specified and make sure they are valid" then yes, a custom DTD is exactly what you want. But if you want the W3C's validator to approve your pages as XHTML you'll need a different approach.
Ola Tuvesson