6

How can I get Dojo Dijits (1.5.0, currently) to work with XHTML as application/xml+xhtml? It works if sent as text/html, but application/xml+xhtml is required.

This seems to be tied to dijit.form.DatePicker and a few others.

This isn't a matter of validating against W3C, it just plain doesn't work, at all.

Error: mismatched tag. Expected: </br>.
Source File: 
Line: 5, Column: 54
Source Code:
  ><div class="dijitReset dijitValidationIcon"><br></div

JavaScript execution stops because of this error.

Obviously, I can recompile Dojo, and fix all of these individually, but this is a lot of work, and does not fix everything.

Once again, it works with text/html, but application/xml+xhtml is required.

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
mctom987
  • 854
  • 2
  • 9
  • 24
  • possible duplicate of [Dojo - XHTML validation ?](http://stackoverflow.com/questions/530560/dojo-xhtml-validation) – Andreas Dolk Jul 20 '10 at 08:20
  • 2
    FWIW, in 1.5 Dijit seems to have fixed all the XHTML validation in the templates. Also worth pointing out Dojo 1.4.3/1.5 is completely XHTML compatible, the Dijit library was the offender here. – dante Jul 20 '10 at 17:45
  • Still not working as application/xml+xhtml with Dojo 1.5. – mctom987 Aug 02 '10 at 17:30
  • What type of build are you using? What is the setup that you are doing to generate this error? What server side technology are you using? – Anh-Kiet Ngo Aug 18 '10 at 05:40
  • Using the latest 1.5 from Google CDN, setup is as simple as
    . SS is irrelevant, as JavaScript is frontend, but PHP.
    – mctom987 Aug 18 '10 at 21:28

3 Answers3

4

This was fixed with the upcoming (as in this week) release of the Dojo Toolkit 1.5, but if you find the corresponding Dijit template in question, you can just change it to
without any side effects.

Hope that helps.

Tom Trenka
  • 41
  • 1
  • Using Dojo 1.5 now, but still have the same issues as before. – mctom987 Jul 23 '10 at 02:20
  • This is odd, I am looking through the source code for both 1.4.3 and 1.5, the 1.5 source code does not have the bug you mentioned. http://svn.dojotoolkit.org/src/tags/release-1.4.3/dijit/form/templates/ValidationTextBox.html vs http://svn.dojotoolkit.org/src/tags/release-1.5.0/dijit/form/templates/ValidationTextBox.html. As you can see, the
    does not exist in version 1.5.
    – Anh-Kiet Ngo Aug 22 '10 at 06:41
  • Actually, the ValidationTextBox is malformed indeed. it has this snippet: /dex="-1" readOnly waiRole/ where it should be: /dex="-1" readonly="readonly" waiRole/ Notice the part about the readonly. – mctom987 Aug 24 '10 at 20:45
1

I asked about the server side in case you were serving up your own build. Anyway, I know you don't want to do individual patches and rebuilds, but I think there is a solution where you can "patch" yet don't have to rebuild. Since the build internalizes the string into the function constructor, you can change it by using the extend functionality. In this case, for ValidationTextBox, you can do

dijit.form.ValidationTextBox.extend({
    templateString: "<div>apple sauce</div>"
});

This will get all future instantiation of dijit.form.ValidationTextBox to use the new template string. Though this might not be ideal, but it might be the only way for you to fix this without rebuilding the entire thing. Probably something in the form of,

dojo.require("dijit.form.ValidationTextBox");
dojo.require("my.ValidationTextBoxFix");

Good luck.

Anh-Kiet Ngo
  • 2,151
  • 1
  • 14
  • 11
-1

in xhtml you should have

<br/>

or

<br></br>

but I'm curious: who requires xhtml and for what?

irreputable
  • 44,725
  • 9
  • 65
  • 93