Bug 87349

Summary: REGRESSION(r96517): Attribute selector fails to match dynamically modified style attribute
Product: WebKit Reporter: Mike Lawther <mikelawther>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cmarcelo, kling, koivisto, macpherson, menard, sam, simon.fraser, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
repro
none
minimal repro
none
patch kling: review+

Mike Lawther
Reported 2012-05-24 00:03:34 PDT
As reported in at http://crbug.com/127655 Attached is a not-quite-minimal repro of a selector not working ('#container > div[style] img[border="0"]'). I've bisected it down to between 96490 and 96521, and 96517 seems most likely within that range. The original reporter also notes that in his live site (http://winfuture.de): - open console - type document.querySelector('#container > div[style] img[border="0"]') -> you get NULL - type document.querySelector('img[border="0"]') -> you get the first element - type document.querySelector('#container > div[style] img[border="0"]') -> you get the first element It looks like the second line does something to a cache somewhere so the querySelector works the second time. I tried to repro this with a simple static page, but could not. It appears important that the elements are added dynamically.
Attachments
repro (2.90 KB, text/html)
2012-05-24 00:04 PDT, Mike Lawther
no flags
minimal repro (1.16 KB, text/html)
2012-05-24 16:22 PDT, Mike Lawther
no flags
patch (3.87 KB, patch)
2012-05-28 09:02 PDT, Antti Koivisto
kling: review+
Mike Lawther
Comment 1 2012-05-24 00:04:19 PDT
Mike Lawther
Comment 2 2012-05-24 16:22:18 PDT
Created attachment 143916 [details] minimal repro Here is a minimal repro, courtesy of geki007 (from the original crbug report).
Antti Koivisto
Comment 3 2012-05-28 09:02:07 PDT
Created attachment 144374 [details] patch Thanks for the repro!
Andreas Kling
Comment 4 2012-05-28 09:09:05 PDT
Comment on attachment 144374 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=144374&action=review > Source/WebCore/css/SelectorChecker.cpp:407 > + // Style attribute is generated lazily but the fast path doesn't do trigger that. This comment doesn't do English :( > LayoutTests/fast/css/dynamic-style-attribute-query.html:12 > +document.addEventListener("DOMContentLoaded", test , false); Silly space after 'test'.
Andreas Kling
Comment 5 2012-05-28 09:10:15 PDT
Funny problem btw! r=me, etc.
Antti Koivisto
Comment 6 2012-05-28 09:22:34 PDT
Note You need to log in before you can comment on or make changes to this bug.