Migrate from GitHub to SourceForge with this tool. Check out all of SourceForge's recent improvements.
Close

#44 color value in css3 linear-gradient function are parsed as error

0.9.11
closed
RBRi
None
1
2013-12-27
2013-12-03
No

I noticed following issue by using CSS Parser 0.9.11.

The parser failed to parse following css3:

.test{
background: linear-gradient(top,#fff 0,#f2f2f2 100%);
}

The error message is:

ERROR: at position <2,37> Error in expression. (Invalid token "#fff". Was expecting one of: <S>, <NUMBER>, <IDENT>, <STRING>, <PLUS>, <COMMA>, <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <PERCENTAGE>, <URI>, "-", "=", ")".)

For me it seems that the CCS3 gramma does not support color expressions within such gradient functions. Sharp and also rgb color expressions are not supported.

The test code parsing the file above looks like:

    final CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
    final ErrorHandler errorHandler = new ParsingErrorHandler();
    parser.setErrorHandler(errorHandler);

    final InputSource source = new InputSource(new StringReader(text));
    CSSStyleSheet result = parser.parseStyleSheet(source, null, null);

Discussion

  • RBRi

    RBRi - 2013-12-03
    • status: open --> accepted
    • assigned_to: RBRi
     
  • RBRi

    RBRi - 2013-12-27

    fixed in SVN, a new snapshot build is available

     
  • RBRi

    RBRi - 2013-12-27
    • status: accepted --> closed
     

Anonymous
Anonymous

Cancel  Add attachments