views:

671

answers:

2

Is it possible to make Dojo (javascript) widgets validate for XHTML?

If so, how?

Can it be something as simple as using CDATA?

+1  A: 

Yes, instead of using the dojoType="dojo.foo.bar" non-standard attribute, you instead need to have a document onload event that "takes over" standard HTML tags in your document and rewrites them into Dojo ones.

Chris KL
It's just a lot more work!
Chris KL
Can I not use something like CDATA tags to make this work?
A: 

CDATA won't help you here. If you really want to write code according to XHTML DTD/schema, you can do it, but cannot take advantage of the flexibility of Dojo markup language (DojoML). What you can do is that you define your own way to mark the widgets, like <div class="dojoButton"/> and then you instantiate them on the page load using something like:

dojo.query('div[class=dojoButton]').instantiate(
  dijit.form.Button, {}
);

Before you do that, please have a look at this paragraph Dojo Doesn’t Validate (in the middle of the article) and this Dojo Degradability.

Maine