Skip to main content

Bug Tracker

Side navigation

#6621 closed bug (wontfix)

Opened June 01, 2010 12:37PM UTC

Closed November 03, 2010 09:30PM UTC

urlFilter function on the omgrequire branch incorrectly handle namespaces

Reported by: tnadav Owned by:
Priority: undecided Milestone: 1.4.3
Component: unfiled Version:
Keywords: Cc:
Blocked by: Blocking:
Description

There is a bug in the urlFilter function (file core.js, line 759, branch omgrequire).

If a defined namespace path has a dot in it, the function turns it into a foreword slash.

For example, when there is a namespace named test and it's path is http://www.jquery.com the function turn test.hello into http://www/jquery/com/hello.js.

that's because the function turns foreword slashes into dots after the namespace path is added, so the solution is to do it before the namespace path is added.

A fixed function would look like this:

jQuery.require.urlFilter = function(url) {

if ( !/\\./.test(url) || (/^([\\w\\d$]+)./.test(url) && !/\\//.test( url ) && !/.js$/.test( url )) ) {

url = url.replace(/\\./g, "/").replace(/^([\\w\\d$]+)./, function(all, name) {

return (requireNamespaces[name] || name) + "/";

}) + ".js";

}

return url;

}

Attachments (0)
Change History (2)

Changed June 01, 2010 12:41PM UTC by tnadav comment:1

I'm adding a link for the fixed function so you can understand what is written

http://gist.github.com/420899

Changed November 03, 2010 09:30PM UTC by snover comment:2

priority: → undecided
resolution: → wontfix
status: newclosed

omgrequire is not maintained.