Dojo - XHTML validation?

时光毁灭记忆、已成空白 提交于 2019-12-08 05:06:43

问题


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

If so, how?

Can it be something as simple as using CDATA?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/530560/dojo-xhtml-validation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!