Honor context object's document's quirks mode in querySelector.
When CSSParserContext is created, it determines whether the context is in quirks mode or not, by looking at master document's quirks mode flag instead of context object's document. This worked for stylesheets in <style> element in an import, because the style rules defined there actually applies to the master document. This caused problem for querySelector/querySelectorAll because the query mode mismatches when the master document is in quirks mode. HTML Imports are always in no quirks mode without DOCTYPE declaration[1][2]. As we optimize ID match for quirks mode by lowercasing IDs in HTML and ID selectors in CSS, but when the master document is in quirks mode, querySelector in import ran in quirks mode (thus selector was lowercased) while IDs in import are preserving case, and never matched. The fix for this is to check if it is in querySelector (i.e. not using dynamic profile), use the document's mode, rather than its master document's mode. [1] http://w3c.github.io/webcomponents/spec/imports/#additions-to-tree-construction-algorithm [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=24349 Bug: 621172 Change-Id: I110bd62df962009ee015239fbc0e5fe24a1e6893 Reviewed-on: https://chromium-review.googlesource.com/544732 Commit-Queue: Takayoshi Kochi <kochi@chromium.org> Reviewed-by:Rune Lillesveen <rune@opera.com> Cr-Commit-Position: refs/heads/master@{#481911}
Showing
Please register or sign in to comment