Opened 12 years ago

Closed 12 years ago

#3973 closed defect (fixed)

dojo.require doesn't support base tag

Reported by: guest Owned by: James Burke
Priority: high Milestone: 0.9
Component: Loader Version: 0.9
Keywords: Cc: alex
Blocked By: Blocking:

Description

Using a base tag in html will ensure you are always able to use a site relative path for all dependencies. dojo.require fails if a base tag is used.

maintenance

-States.htm

scripts

dojo

-dojo.js

With this folder structure, the first require when loading States.htm (included below) is for the firebug.js in IE or lang.js for FireFox?. dojo.require tries to get the code from .../maintenance/scripts/dojo/_firebug/firebug.js or .../maintenance/scripts/dojo/_base/lang.js.

Looks like either the _getText in hostenv_browser.js or the constructor for dojo._Url in loader.js needs to change to check for a base tag.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
	<base href='http://mikes:80/atg-framework/'></base>
	<title>Test Page</title>
	<script type="text/javascript" src="scripts/dojo/dojo.js" djconfig="parseOnLoad: true, isDebug: true"></script>
</head>
<body>
</body>
</html>

Attachments (1)

hostenv_browser.patch (403 bytes) - added by guest 12 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 12 years ago by guest

Seems like a simple fix for this is to remove the window.location from the dojo._Url construction. Patch attached. I have tried this on IE with and without a base tag and it seems to work fine. No other browsers tested.

Changed 12 years ago by guest

Attachment: hostenv_browser.patch added

comment:2 Changed 12 years ago by James Burke

Cc: alex added
Milestone: 0.9
Owner: changed from alex to James Burke

I would like to remove that dojo._Url call too, but it was done to fix #2757. There is something really weird going on with Mozilla, and I haven't been able to isolate why it is happening. I've tried a couple times already, but no luck so far. I'll see if I can do more investigation before 0.9 wraps up.

comment:3 Changed 12 years ago by James Burke

Just as a side note, confirming the code in this ticket description is using the correct usage of the base tag (confirmed against comments in #1991).

comment:4 Changed 12 years ago by James Burke

Resolution: fixed
Status: newclosed

(In [10088]) Fixes #3973. Support BASE tags. Does not work with Opera 9.22, but it could be a general issue with Opera, base tags and XHR loading. Still would like to fix the core issue of why we need a dojo._Url call in here, but can't seem to crack it.

Note: See TracTickets for help on using tickets.