Menu

#57 Conflict between initial value and specified value

closed
nobody
None
1
2015-01-10
2014-09-26
mercury
No

Apropos this test case:
http://test.csswg.org/suites/css2.1/20110323/html4/keywords-000.htm

The p element matches three rules. The first rule sets the background to green, the second one sets the background to initial value (because the quoted string 'red' is not recognized as a keyword) and the third one sets the foreground color.

This test fails in CSSBox because, when analysing a matching p element, the analyzer sets the background property to its initial value without considering if it has been set in another rule.

From my current understanding of jStyle and CSS spec, this could be solved in two ways:

  1. During analysis, set the initial value of a property only if it has not been specified in another rule that matches the current element.

  2. Never set the initial value for any property. Let the layout / render choose the initial value whenever a property is left unspecified after analysis.

1 Seems like a dirty hack to me.

2 Is probably a robust way to solve this, but it might require changes to the layout / render components too.

Discussion

  • mercury

    mercury - 2014-09-26

    Whoa, the last two lines became large by accident. And I can't seem to edit the description now.

     
  • mercury

    mercury - 2014-09-27

    We just now realized that there are other cases that we hadn't considered before making the suggestions. We later imagined about 32+ combinations involving:
    * short form v/s long form properties
    * declarations within same rule v/s separate rules
    * invalid v/s missing properties in a short form property

    We were also looking at the behavior of popular browsers and trying to reconcile with our understanding of the specs.

    We couldn't reach a definite understanding so far. Frankly, it was a little above our heads. Will update here if we manage to grok it.

    best,
    hrj

     
  • Radek Burget

    Radek Burget - 2014-09-28

    Normally, declarations containing errors (like the background:"red" one) should be completely ignored. In this case, the background variator was not checking the background-position for errors so anything was accepted as background-position and the default color was then used for background-color. Hopefuly fixed by this commit.

     
  • Chetan Kothari

    Chetan Kothari - 2014-09-29

    Thanks for the fix Radek, verified the fix and works as expected.

     
  • Radek Burget

    Radek Burget - 2014-09-29
    • status: open --> accepted
     
  • Radek Burget

    Radek Burget - 2015-01-10
    • status: accepted --> closed
     
  • Radek Burget

    Radek Burget - 2015-01-10

    Closed in 1.19

     

Anonymous
Anonymous

Add attachments
Cancel