Skip to content

Commit

Permalink
fixed bug in image path rewriting. BG image paths should hit images c…
Browse files Browse the repository at this point in the history
…orrectly now.
  • Loading branch information
scottjehl committed Mar 3, 2011
1 parent ee712f5 commit 0e35c3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion respond.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions respond.src.js
Expand Up @@ -41,9 +41,10 @@
if( !!href && !parsedSheets[ href ] ){ if( !!href && !parsedSheets[ href ] ){
if( !/^([a-zA-Z]+?:(\/\/)?(www\.)?)/.test( href ) if( !/^([a-zA-Z]+?:(\/\/)?(www\.)?)/.test( href )
|| href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){ || href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){
var fullhref = href;
ajax( href, function( styles ){ ajax( href, function( styles ){
translate( styles, href ); translate( styles, fullhref );
parsedSheets[ href ] = true; parsedSheets[ fullhref ] = true;
} ); } );
} }
else{ else{
Expand All @@ -56,7 +57,11 @@
translate = function( styles, href ){ translate = function( styles, href ){
var qs = styles.match( /@media ([^\{]+)\{([\S\s]+?)(?=\}\/\*\/mediaquery\*\/)/gmi ), var qs = styles.match( /@media ([^\{]+)\{([\S\s]+?)(?=\}\/\*\/mediaquery\*\/)/gmi ),
ql = qs && qs.length || 0, ql = qs && qs.length || 0,
href = href.substring( 0, href.lastIndexOf( "/" )) + "/"; //try to get CSS path
href = href.substring( 0, href.lastIndexOf( "/" ));

//if path exists, tack on trailing slash
if( href.length ){ href += "/"; }


for( var i = 0; i < ql; i++ ){ for( var i = 0; i < ql; i++ ){
var fullq = qs[ i ].match( /@media ([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1, var fullq = qs[ i ].match( /@media ([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1,
Expand Down

0 comments on commit 0e35c3b

Please sign in to comment.