Skip to content

Commit

Permalink
Fix for issue 5. HTTP requests now respect original casing, but do co…
Browse files Browse the repository at this point in the history
…mparison (for identity) in a case-insensitive way.
  • Loading branch information
BorisMoore committed Apr 21, 2011
1 parent fa02ec4 commit 0856669
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions jquery.defer.js
Expand Up @@ -14,8 +14,7 @@ function absUrl( basePath, url ) {
if ( url.indexOf( "://") === -1 ) {
url = basePath + url;
}
anchor.href = url;
return anchor.href.toLowerCase();
return anchor.href = url;
// For IE without DOCTYPE - need use recursive regex along lines: parts = url.split( "/../" ); parts[0] = parts[0].slice( 0, parts[0].lastIndexOf("/") + 1 ); Use recursive regex; return parts.join("").toLowerCase();
}

Expand Down Expand Up @@ -43,14 +42,16 @@ function normalize( items, basePath ) {
}

function getScriptDef( name, thisUrl ) {
var scriptDef = defer[ name ];
var thisUrlKey,
scriptDef = defer[ name ];

if ( scriptDef ) {
return scriptDef;
}

thisUrl = absUrl( getBasePath( thisUrl || "" ), name );

return scriptByUrl[ thisUrl ] || (scriptByUrl[ thisUrl ] = { url: thisUrl });
thisUrlKey = thisUrl.toLowerCase();
return scriptByUrl[ thisUrlKey ] || (scriptByUrl[ thisUrlKey ] = { url: thisUrl });
}

$.extend({
Expand Down
11 changes: 6 additions & 5 deletions jsdefer.js
Expand Up @@ -274,8 +274,7 @@ function absUrl( basePath, url ) {
if ( url.indexOf( "://") === -1 ) {
url = basePath + url;
}
anchor.href = url;
return anchor.href.toLowerCase();
return anchor.href = url;
// For IE without DOCTYPE - need use recursive regex along lines: parts = url.split( "/../" ); parts[0] = parts[0].slice( 0, parts[0].lastIndexOf("/") + 1 ); Use recursive regex; return parts.join("").toLowerCase();
}

Expand Down Expand Up @@ -303,14 +302,16 @@ function normalize( items, basePath ) {
}

function getScriptDef( name, thisUrl ) {
var scriptDef = defer[ name ];
var thisUrlKey,
scriptDef = defer[ name ];

if ( scriptDef ) {
return scriptDef;
}

thisUrl = absUrl( getBasePath( thisUrl || "" ), name );

return scriptByUrl[ thisUrl ] || (scriptByUrl[ thisUrl ] = { url: thisUrl });
thisUrlKey = thisUrl.toLowerCase();
return scriptByUrl[ thisUrlKey ] || (scriptByUrl[ thisUrlKey ] = { url: thisUrl });
}

$.extend({
Expand Down

0 comments on commit 0856669

Please sign in to comment.