- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Mon, 02 Aug 2010 21:44:10 -0400
- To: Arron Eicholz <Arron.Eicholz@microsoft.com>
- CC: "public-css-testsuite@w3.org" <public-css-testsuite@w3.org>, www-style list <www-style@w3.org>
On 8/2/10 6:34 PM, Arron Eicholz wrote: > http://test.csswg.org/source/contributors/mozilla/submitted/css2.1/selectors/first-line-floats-002.htm This is a very interesting testcase that I wrote because the spec is pretty clear here but the behavior of some UA's didn't make sense. The testcase is basically: <style> div { color: red; } div:first-line { color: green } </style> <div> <span> <span style="float: left">This should be green</span> </span> </div> Ignoring the first-line business for the moment, the float inherits its color from the outer <span>. But section 5.12.1 explicitly says that this markup should behave just like this markup: <div style="color: red"> <div:first-line style="color: green"> <span> <span style="float: left">This should be green</span> </span> </div:first-line> </div> At least Opera and Webkit (I don't have IE8 on hand right this second) don't implement this; they make the computed color style of the <span> be the computed color of the <div>, while the color of the _text_ inside the <span> is the color specified for the first-line. In other words, they produce something more like this markup: <div style="color: red"> <span> <span style="float: left">This should be green</span> <div:first-line style="color: green"> </div:first-line> </span> </div> for purposes of style inheritance. At least insofar as I can trust what getComputedStyle returns. Gecko, on the other hand, implements what the spec says to do, which has the obvious consequence that the computed color of the outer <span> is green, whereas it's red in Webkit and Opera. So as far as I can tell, the test is in fact correct. > :first-line does not apply to block-level descendants that are floats. It's not in this case; this is testing purely style inheritance, not where "first-line" is applied to (which you could test by using a background or text-decoration or some other non-inherited style). -Boris
Received on Tuesday, 3 August 2010 01:44:46 UTC