Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#7455 closed defect (fixed)

dojo does not load in Opera 9.51 with content type "application/xhtml+xml"

Reported by: chucky Owned by: alex
Priority: high Milestone: 1.3
Component: Core Version: 1.2beta
Keywords: Cc: tomas.mikula@…
Blocked By: Blocking:

Description

When the server specifies the content type "application/xhtml+xml", dojo does not load in Opera 9.51 (for Linux). When the content type is "text/html", it works fine.

Consider the following minimal example page:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Dojo Test</title>
	<script type="text/javascript" src="dojo/dojo.js"></script>
</head>
<body>
	<div>dojo = <script type="text/javascript">document.write(typeof dojo);</script></div>
</body>
</html>

In Opera 9.51 (for Linux) the output differs based on the content type specified by the server. I put this example here:
http://adela.feld.cvut.cz:8080/dojotest/?ct=xhtml
http://adela.feld.cvut.cz:8080/dojotest/?ct=html
The first URL returns the above document with content type header "application/xhtml+xml", the second URL returns it with "text/html".

This is probably a bug in Opera, but I suppose it could be fixed more promptly in Dojo.

In dojo/dojo.js there is this block of code

try{
	document.write("<scr"+"ipt type='text/javascript' src='"+tmps[x]+"'></scr"+"ipt>");
}catch(e){
	var script = document.createElement("script");
	script.src = tmps[x];
	document.getElementsByTagName("head")[0].appendChild(script);
}

If I exchange the contents of the try and catch blocks, it fixes the problem for me (in Opera 9.51, but I don't know if it doesn't break the functionality in other browsers)

Change History (6)

comment:1 Changed 11 years ago by James Burke

Resolution: wontfix
Status: newclosed

The problem fragment you mention is in the non-build version of dojo.js. Use a built version of dojo.js to avoid the issue. Given that this is a small edge case (Opera with application/xhtml+xml) marking as a wontfix, since the issue only shows up with running dojo from the non-built source.

comment:2 Changed 11 years ago by alex

just as a quick follow-up, I think this might be related to Opera's super-lame behavior of *immediately* and *synchronously* eval-ing the contents of a script for which you add to a document. This behavior causes the assumptions of the package system to break (i.e., that the next script won't start until this one is done executing). A fix is possible, but it's more likely that Opera will fix their behavior WRT other browsers long term.

comment:3 Changed 11 years ago by alex

Milestone: tbd1.3
Resolution: wontfix
Status: closedreopened
Version: 1.1.11.2beta

comment:4 Changed 11 years ago by alex

Owner: changed from anonymous to alex
Status: reopenednew

comment:5 Changed 11 years ago by alex

Resolution: fixed
Status: newclosed

(In [15411]) make the default loader work in strict XHTML environments and fix Opera to correctly detect case sensitivity in XML/XHTML environments for queries. A small PHP script is added to test these. Sadly, both Safari and Opera don't observe script ordering for injected tags, so we had to make the dev loader script a bit more complicated to accomidate. Fixes #7455. Fixes #7214. !strict

comment:6 Changed 11 years ago by James Burke

alex: this patch also introduces a dojo.createElement and dojo.elem in dojo/trunk/_base/html.js. Was that intentional?

Note: See TracTickets for help on using tickets.