#3 rgb or other functions at start of property truncates it

closed
None
5
2012-07-18
2005-04-15
Anonymous
No

Try parsing the following CSS:

foo {
background: #e8eff5
url(../images/bottom-angle.png) no-repeat;
}

or, equivalently (though it's a different colour):

foo {
background: rgb(10,11,12)
url(../images/bottom-angle.png) no-repeat;
}

In both cases, everything after the colour (e.g. the
url and no-repeat) gets dropped from the parsed value.

We think this might be a bug somewhere in the
CSSValueImpl constructor, but we aren't sure.

My email address is dan.cooperstock@quest.com.

Discussion

  • Dan Cooperstock

    Dan Cooperstock - 2005-04-15

    Logged In: YES
    user_id=1260146

    OK, I think I have a fix for this. Change line 63 (I think),
    which is the first line of code in its two-argument
    constructor, from the following:

    if (value.getParameters() != null) {

    to this:

    if (value.getNextLexicalUnit() == null &&
    value.getParameters() != null) {

    I'm not sure that I can explain why it works, but it does
    seem to work.

     
  • Nobody/Anonymous

    Logged In: NO

    For anybody interested that fix works for me too and I have made the changes to our version of the parser, does anybody have the power to check this fix in? is this project still maintained?

    Cheers Dan...good work fella!

     
  • Nobody/Anonymous

    Logged In: NO

    I traced through the problem in the debugger BEFORE I found out about this bug entry. The function gets passed a 'value' parameter. For shorthand CSS properties, this can contain several values in a doubly-linked list.

    The buggy code is only looking at the first value, sees that there's an RGB value and constructs an RGB object for the CSS property.

    Adding the check to see if there's more than one value for the property, results in the code to iterate through all the properties and add them to this CSS property.

    If this fix isn't made soon, I'd suggest forking the project, so changes can be made.

     
  • Daniel Gredler

    Daniel Gredler - 2008-03-25

    Logged In: YES
    user_id=1109422
    Originator: NO

    This seems to be fixed now; I've added a regression unit test.

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks