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
The root issue is a single ShareableElementData is unexpectedly shared in a quirks-mode document and a standard-mode document.
Now WPT has a test. http://w3c-test.org/quirks-mode/classname-query-after-sibling-adoption.html
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!
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
The bug is still there, and we can fix it by merging the Blink change.
<rdar://problem/98786212>
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.
Pull request: https://github.com/WebKit/WebKit/pull/3413
Committed 253975@main (2837601ea97b): <https://commits.webkit.org/253975@main> Reviewed commits have been landed. Closing PR #3413 and removing active labels.