Bug 64372 - CSS attribute selector + descendant not styled correctly
Summary: CSS attribute selector + descendant not styled correctly
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://jsfiddle.net/aUCkn/
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-12 11:10 PDT by bug
Modified: 2011-07-18 03:46 PDT (History)
3 users (show)

See Also:


Attachments
Patch with failing layout test (2.94 KB, patch)
2011-07-12 20:09 PDT, Dominic Cooney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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/