File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ module.exports = function (css) {
6262 . replace ( / ^ ' ( .* ) ' $ / , function ( o , $1 ) { return $1 ; } ) ;
6363
6464 // already a full url? no change
65- if ( / ^ ( # | d a t a : | h t t p : \/ \/ | h t t p s : \/ \/ | f i l e : \/ \/ \/ ) / i. test ( unquotedOrigUrl ) ) {
65+ if ( / ^ ( # | d a t a : | h t t p : \/ \/ | h t t p s : \/ \/ | f i l e : \/ \/ \/ | \s * $ ) / i. test ( unquotedOrigUrl ) ) {
6666 return fullMatch ;
6767 }
6868
Original file line number Diff line number Diff line change @@ -143,6 +143,17 @@ describe("fix urls tests", function() {
143143 assertUrl ( "body { background-image:url(#bg.jpg); }" ) ;
144144 } ) ;
145145
146+ // empty urls
147+ it ( "Empty url should be skipped" , function ( ) {
148+ assertUrl ( "body { background-image:url(); }" ) ;
149+ assertUrl ( "body { background-image:url( ); }" ) ;
150+ assertUrl ( "body { background-image:url(\n); }" ) ;
151+ assertUrl ( "body { background-image:url(''); }" ) ;
152+ assertUrl ( "body { background-image:url(' '); }" ) ;
153+ assertUrl ( "body { background-image:url(\"\"); }" ) ;
154+ assertUrl ( "body { background-image:url(\" \"); }" ) ;
155+ } ) ;
156+
146157 // rooted urls
147158 it ( "Rooted url" , function ( ) {
148159 assertUrl (
You can’t perform that action at this time.
0 commit comments