Bug 173528 - Class matching fails after moving an element from a quirks-mode document to a standard-mode document
Summary: Class matching fails after moving an element from a quirks-mode document to a...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryan Reno
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-06-18 16:19 PDT by Kent Tamura
Modified: 2022-08-31 00:59 PDT (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2017-06-18 16:19:08 PDT
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
Comment 1 Kent Tamura 2017-06-18 16:33:07 PDT
The root issue is a single ShareableElementData is unexpectedly shared in a quirks-mode document and a standard-mode document.
Comment 2 Kent Tamura 2017-06-25 17:06:00 PDT
Now WPT has a test.

http://w3c-test.org/quirks-mode/classname-query-after-sibling-adoption.html
Comment 3 Ahmad Saleem 2022-08-16 16:50:20 PDT
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!
Comment 5 Ryosuke Niwa 2022-08-17 00:42:22 PDT
The bug is still there, and we can fix it by merging the Blink change.
Comment 6 Radar WebKit Bug Importer 2022-08-17 09:35:36 PDT
<rdar://problem/98786212>
Comment 7 Ryan Reno 2022-08-17 10:27:59 PDT
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.
Comment 8 Ryan Reno 2022-08-17 11:20:13 PDT
Pull request: https://github.com/WebKit/WebKit/pull/3413
Comment 9 EWS 2022-08-31 00:59:45 PDT
Committed 253975@main (2837601ea97b): <https://commits.webkit.org/253975@main>

Reviewed commits have been landed. Closing PR #3413 and removing active labels.