Bug 64372

Summary: CSS attribute selector + descendant not styled correctly
Product: WebKit Reporter: bug
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: bfulgham, daniel.baulig, dominicc, hyatt
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://jsfiddle.net/aUCkn/
Attachments:
Description Flags
Patch with failing layout test none

Description bug 2011-07-12 11:10:20 PDT
When using the attribute selector in combination with a descendant, styles are not being applied correctly.


Test: http://jsfiddle.net/aUCkn/
You may also take a look at http://stackoverflow.com/questions/6655364/css-attribute-selector-descendant-gives-a-bug-in-webkit/ where this bug is being discussed.
Comment 1 Dominic Cooney 2011-07-12 20:09:36 PDT
Created attachment 100613 [details]
Patch with failing layout test

The jsfiddle as a layout test.

Expected result: lines are blue/green/green.

Safari Version 5.0.4 (6533.20.27) fails—lines are blue/blue/blue.
Chrome 14.0.803.0 (Official Build 90483) dev Mac OS WebKit 535.1 (trunk@89703) fails—lines are blue/blue/green.
WebKit nightly r90810 fails—lines are blue/blue/green.
Firefox 5.0 passes.

It is interesting to note how sensitive this is to whitespace in the element with the attribute, as discussed on the StackOverflow bug. For example, if the first div[foo="green"] does not have child whitespace, then both div[foo="green"] render correctly (regardless of whitespace in the second one.)
Comment 2 daniel.baulig 2011-07-18 03:46:20 PDT
Just in case this will provide anything: I encountered a bug that seems to be related. I was made aware of this bug report when I posted a thread about the bug on SO: 
http://stackoverflow.com/questions/6728175/why-will-webkit-not-repaint-my-webpage-properly
It also contains a jsFiddle which demonstrates the behaviour, allthough it is much more complex than dadu's fiddle:
http://jsfiddle.net/WHewK/
Comment 3 Brent Fulgham 2022-07-12 14:57:16 PDT
Safari, Chrome, and Firefox all agree on rendering for this test case. I don't believe there is any remaining compatibility issue.