Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1367)

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html

Issue 2252003002: Change custom element state in documents without browsing context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dominicc review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html b/third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html
index b2cd70c290c1b2a90020677c309c61dd7a83df8e..2345edf9d1318caae8a2fdcce59780424bdee3de 100644
--- a/third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/selectors/pseudo-class-defined.html
@@ -28,16 +28,16 @@ iframe.onload = () => {
test_defined(data.defined, doc.getElementsByTagName(data.tag_name)[0], `<${data.tag_name}>`);
// Test DOM createElement() methods.
- test_defined_for_createElement(data.defined, doc, data.tag_name);
+ test_defined_for_createElement(data.defined, !data.defined, doc, data.tag_name);
- // Documents without browsing context should be "uncustomized"; i.e., "defined".
- test_defined_for_createElement(true, doc_without_browsing_context, data.tag_name, 'Without browsing context: ');
+ // Documents without browsing context should behave the same.
+ test_defined_for_createElement(data.defined, false, doc_without_browsing_context, data.tag_name, 'Without browsing context: ');
}
done();
};
-function test_defined_for_createElement(defined, doc, tag_name, description = '') {
+function test_defined_for_createElement(defined, should_test_change, doc, tag_name, description = '') {
// Test document.createElement().
let element = doc.createElement(tag_name);
doc.body.appendChild(element);
@@ -54,8 +54,9 @@ function test_defined_for_createElement(defined, doc, tag_name, description = ''
test_defined(true, svg_element, `${description}createElementNS("http://www.w3.org/2000/svg", "${tag_name}")`);
// Test ":defined" changes when the custom element was defined.
- if (!defined) {
+ if (should_test_change) {
let w = doc.defaultView;
+ assert_false(!w, 'defaultView required to test change');
w.customElements.define(tag_name, class extends w.HTMLElement {
constructor() { super(); }
});

Powered by Google App Engine
This is Rietveld 408576698