Bug 87349 - REGRESSION(r96517): Attribute selector fails to match dynamically modified style attribute
Summary: REGRESSION(r96517): Attribute selector fails to match dynamically modified st...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-24 00:03 PDT by Mike Lawther
Modified: 2012-05-28 09:22 PDT (History)
8 users (show)

See Also:


Attachments
repro (2.90 KB, text/html)
2012-05-24 00:04 PDT, Mike Lawther
no flags Details
minimal repro (1.16 KB, text/html)
2012-05-24 16:22 PDT, Mike Lawther
no flags Details
patch (3.87 KB, patch)
2012-05-28 09:02 PDT, Antti Koivisto
kling: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Lawther 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.
Comment 1 Mike Lawther 2012-05-24 00:04:19 PDT
Created attachment 143749 [details]
repro
Comment 2 Mike Lawther 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).
Comment 3 Antti Koivisto 2012-05-28 09:02:07 PDT
Created attachment 144374 [details]
patch

Thanks for the repro!
Comment 4 Andreas Kling 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'.
Comment 5 Andreas Kling 2012-05-28 09:10:15 PDT
Funny problem btw! r=me, etc.
Comment 6 Antti Koivisto 2012-05-28 09:22:34 PDT
http://trac.webkit.org/changeset/118688