Bug 173528
Summary: | Class matching fails after moving an element from a quirks-mode document to a standard-mode document | ||
---|---|---|---|
Product: | WebKit | Reporter: | Kent Tamura <tkent> |
Component: | DOM | Assignee: | Ryan Reno <rreno> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ahmad.saleem792, ap, ashley, bfulgham, cdumez, koivisto, rniwa, rreno, simon.fraser, webkit-bug-importer, zalan |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari Technology Preview | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
See Also: |
https://bugs.webkit.org/show_bug.cgi?id=244023 https://bugs.webkit.org/show_bug.cgi?id=244022 |
Kent Tamura
crbug.com/733682
With the following page, "Second query result should not be null:" should not be null, but Safari TP 30 says "null".
<!-- quirks mode -->
<body>
<dialog>
<button class="nextButton"></button>
<button class="nextButton"></button>
</dialog>
<template><div></div></template>
<pre></pre>
<script>
function log(str) { document.querySelector('pre').textContent += str + '\n'; }
log('Main document\'s mode: ' + document.compatMode);
var dialog = document.querySelector('dialog');
var button = dialog.querySelector('.nextButton');
var tc = document.querySelector('template').content;
log('Template document\'s mode: ' + tc.ownerDocument.compatMode);
tc.ownerDocument.adoptNode(button);
log('Second query result should not be null: ' + dialog.querySelector('.nextButton'));
log('Content of context element: ' + dialog.innerHTML);
</script>
</body>
Firefox: not-null
Chrome 61 canary: not-null
Edge: not-null
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Kent Tamura
The root issue is a single ShareableElementData is unexpectedly shared in a quirks-mode document and a standard-mode document.
Kent Tamura
Now WPT has a test.
http://w3c-test.org/quirks-mode/classname-query-after-sibling-adoption.html
Ahmad Saleem
Safari is only browser failing this test case as of STP 151:
https://wpt.fyi/results/quirks/classname-query-after-sibling-adoption.html?label=experimental&label=master&aligned
Just wanted to share updated status. Thanks!
Ahmad Saleem
Chrome Commit modifying "Element.cpp":
https://chromium.googlesource.com/chromium/src.git/+/3d8dd287aeb97d6dbb658da989ac4a4c95853dc7
Webkit Github source:
https://github.com/WebKit/WebKit/blob/8afe31a018b11741abdf9b4d5bb973d7c1d9ff05/Source/WebCore/dom/Element.cpp#L2112
Ryosuke Niwa
The bug is still there, and we can fix it by merging the Blink change.
Radar WebKit Bug Importer
<rdar://problem/98786212>
Ryan Reno
The Blink change fixes this on my Mac. Will need to import the WPT quirks suite as we're missing this and many other tests in our tree. Once that lands, we can get this landed as well.
Ryan Reno
Pull request: https://github.com/WebKit/WebKit/pull/3413
EWS
Committed 253975@main (2837601ea97b): <https://commits.webkit.org/253975@main>
Reviewed commits have been landed. Closing PR #3413 and removing active labels.