CSS url values not trimmed

5 messages - 1327 views

in CSS the values     border-image: url( m.png ) 10 14 10 10;
    bg-image: url( bg.png );
would look for image with SPACEbg.png SPACEm.png and it reports that it could not fine

/img/ bg.png etc..

May be good to support the trim of the value in url as CSS has such support

Other cases are

 

bg-image: url(rb.png,0,0,13,13 );

border-image: url(m.png,0,0,59,46,mirror ) 10 10 10 14;

Observe the space before end bracket

To simplify the parsing code, the parser first split on space and after it check each token ... then it couldn't manage space in tokens.

Interesting.. not sure what else is going wrong with space in these places then..When we remove space from above areas it works fine..

it says bad border-image etc.. May be it has assumption of no spaces in each of the attribute etc..

Quick look at the code shows that issue is in StringUtil

 

public static String extractRawParams(String prefix, String rawData) {
  if (rawData.startsWith(prefix)) {
   int posStart = rawData.indexOf(prefix + "(");
   int posEnd = rawData.indexOf(")");
   if (posStart != -1 && posEnd != -1 && posStart < posEnd) {
    return rawData.substring(posStart + prefix.length() + 1, posEnd);
   }
  }
  return null;
 }

May be the value returned should be trimmed..