Closed
Bug 1419299
Opened 7 years ago
Closed 7 years ago
Fix failure WPT test for document.write() on a data document in custom-elements/parser/parser-uses-registry-of-owner-document.html
Categories
(Core :: DOM: Core & HTML, enhancement, P3)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: jdai, Assigned: edgar)
References
Details
We got test failure at parser-uses-registry-of-owner-document.html[1][2][3]
[1] https://searchfox.org/mozilla-central/rev/919dce54f43356c22d6ff6b81c07ef412b1bf933/testing/web-platform/tests/custom-elements/parser/parser-uses-registry-of-owner-document.html
[2] https://searchfox.org/mozilla-central/rev/919dce54f43356c22d6ff6b81c07ef412b1bf933/testing/web-platform/meta/custom-elements/parser/parser-uses-registry-of-owner-document.html.ini
[3] http://web-platform.test:8000/custom-elements/parser/parser-uses-registry-of-owner-document.html
Reporter | ||
Updated•7 years ago
|
Priority: -- → P2
Reporter | ||
Comment 1•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → echen
Assignee | ||
Comment 2•7 years ago
|
||
Per step 3 of https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-definition, if the document is a data document (e.g. the one created via createDocument()), the document doesn't have an associated browsing context ( https://html.spec.whatwg.org/multipage/browsers.html#concept-document-bc). And nsContentUtils::LookupCustomElementDefinition() should return nullptr for this case.
Assignee | ||
Comment 3•7 years ago
|
||
(In reply to Edgar Chen [:edgar] from comment #2)
> And nsContentUtils::LookupCustomElementDefinition() should return nullptr
> for this case.
We do return nullptr for such case.
The test failure is because of the incorrectness in test itself.
The test is something like,
```
customElements.define("x-foo", class extends HTMLElement {});
var doc = document.implementation.createHTMLDocument();
doc.open();
doc.write('<x-foo></x-foo>');
doc.close();
var foo = doc.querySelector('x-foo');
assert_true(foo instanceof HTMLElement);
assert_false(foo instanceof MyCustomElement);
```
From the spec at step 3 of https://html.spec.whatwg.org/#document-write-steps: "If document is not an active document, then return", so an write() call on a data document should do nothing. And the `foo` should be null in this case. There is a discussion about it, see https://github.com/whatwg/html/issues/2827.
Assignee | ||
Updated•7 years ago
|
Summary: HTML parser must use the registry of window.document in a document created by document.implementation.createHTMLDocument() → Fix failure WPT test for document.write() on a data document in custom-elements/parser/parser-uses-registry-of-owner-document.html
Assignee | ||
Updated•7 years ago
|
Priority: P2 → P3
Assignee | ||
Comment 4•7 years ago
|
||
Assignee | ||
Comment 5•7 years ago
|
||
Fixed and merged in upstream; https://github.com/w3c/web-platform-tests/pull/8537.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•