Opened 13 years ago

Closed 9 years ago

Last modified 9 years ago

#2332 closed defect (fixed)

Problem creating widgets when Web page is tagged as application/xhtml+xml

Reported by: chris.digiano@… Owned by: bill
Priority: high Milestone: 1.6.1
Component: Dijit Version: 0.4.1
Keywords: widget parse xhtml Cc:
Blocked By: Blocking:

Description (last modified by bill)

dojo gets confused when the mime type of the HTML is application/xhtml+xml.

When I have, say, a button in my Web page of type application/xhtml+xml, when dojo tries to transform the button into a fancy css-based one, I get the following errors:

Mac OS X (10.4) Firefox 2.0.0.1-- DEBUG: dojo.widget.Parse: error: [Exception... "An invalid or illegal string was specified" code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)"

Mac OS X (10.4) Safari 2.0.4-- FATAL exception raised: Cannot set do-nothing method on that object onscroll FATAL exception raised: Cannot set do-nothing method on that object onresize

Switching the Web page type to text/html fixes the problem in either browser!

HTML source dump appears below.

Chris DiGiano?


<html xmlns="http://www.w3.org/1999/xhtml"><head> <script type="text/javascript">

djConfig = {isDebug: "true"};

</script> <script type="text/javascript" src="/piki/_js/dojo/dojo.js"/><script type="text/javascript">

dojo.require("dojo.event.*"); dojo.require("dojo.widget.*"); dojo.require("dojo.widget.Button");

function helloPressed() {

alert('You pressed the button');

}

function init() {

var helloButton = dojo.widget.byId('helloButton'); dojo.event.connect(helloButton, 'onClick', 'helloPressed')

}

dojo.addOnLoad(init);

</script> </head> <body> <button dojoType="Button" widgetId="helloButton">Hello World!</button> </body> </html>

Attachments (1)

test_Button.xhtml (12.8 KB) - added by bill 11 years ago.
XHTML test case (put in dijit/tests/form directory)

Download all attachments as: .zip

Change History (16)

comment:1 Changed 13 years ago by dylan

Milestone: 0.9

comment:2 Changed 12 years ago by bill

Component: WidgetsDijit
Milestone: 0.91.0

comment:3 Changed 12 years ago by bill

Milestone: 1.01.1

comment:4 in reply to:  3 Changed 12 years ago by guest

Replying to bill: Any chance of getting this into 1.0? For already existing pages, they sometimes just don't work in HTML - eg if they use XSLT transforms or embedded SVG or the like.

comment:5 Changed 12 years ago by guest

I concur with the previous writer. I'm using MathML in Firefox 2.0, and for that I'd also need the MIME type application/xhtml+xml. Christoph


My project: A semantic wiki for mathematics (based on IkeWiki)

comment:6 Changed 12 years ago by bill

Hi Chris. Please attach a testcase using the "attach file" button. Something that runs against 1.0. Can I access the file via file:// protocol, or do I have to load it over http? What settings do I need in apache to make the mime type be application/xhtml+xml ?

comment:7 Changed 12 years ago by bill

Milestone: 1.12.0

comment:8 in reply to:  6 Changed 12 years ago by guest

Replying to bill:

Hi Chris. Please attach a testcase using the "attach file" button. Something that runs against 1.0. Can I access the file via file:// protocol, or do I have to load it over http? What settings do I need in apache to make the mime type be application/xhtml+xml ?

Maybe I can help here. Either you do some server-side scripting and set the Content-Type HTTP header to "application/xhtml+xml", or, on the client, using Firefox, you name your file *.xhtml or *.xml, but not *.html.

comment:9 Changed 12 years ago by alex

Milestone: 2.01.3

Milestone 2.0 deleted

comment:10 Changed 11 years ago by bill

Description: modified (diff)
Milestone: 1.3future

Well, I think the problems extend beyond the parser. I tried test_Button.html, converted to XHTML (I'll attach the example), and the plain button widgets instantiated correctly but there were errors instantiating the other widgets.

Unfortunately I'm not going to have time to work on this in the forseeable future.

Changed 11 years ago by bill

Attachment: test_Button.xhtml added

XHTML test case (put in dijit/tests/form directory)

comment:11 Changed 9 years ago by doub

I have the same problem on Chrome and FireFox?. The problems seems to be that some string containing non-XML HTML is assigned to a .innerHTML attribute. For example:

Error: malformed Source file: Line: 6, Column: 41 Source Code:

dojoAttachPoint="_menuBtn" showLabel=false>&#9660;</div>

As you can see the showLabel value false lacks proper quotes to be valid XML.

comment:12 Changed 9 years ago by bill

Problems like missing quotes were fixed in #11571, looks like this is a new occurence that slipped in. I'll fix the showLabel attribute, not sure if that's sufficient to fix your problem though.

comment:13 Changed 9 years ago by bill

Milestone: future1.6.1

I'll check in that one fix, let me know if it solves the problem for you. I used a regex to search all of our templates and didn't see any other missing quotes, but I might have missed something, or also (as I said above) fixing missing quotes may not be sufficient to solve the problem.

comment:14 Changed 9 years ago by bill

Resolution: fixed
Status: newclosed

(In [24413]) fix missing quotes around attribute value, fixes #11571 and hopefully fixes #2332.

comment:15 Changed 9 years ago by bill

(In [24414]) merging from trunk/ to 1.6/: fix missing quotes around attribute value, fixes #11571 and hopefully fixes #2332.

Note: See TracTickets for help on using tickets.