Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing of :defined prior to call to super() #25794

Merged
merged 1 commit into from
Sep 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion custom-elements/pseudo-class-defined.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,17 @@
var log = [];
var instance = document.createElement('my-custom-element-2');
document.body.appendChild(instance);
assert_false(instance.matches(":defined"), "Prior to definition, instance should not match :defined");
customElements.define('my-custom-element-2',class extends HTMLElement {
constructor() {
assert_false(instance.matches(":defined"), "During construction, prior to super(), instance should not match :defined");
super();
log.push([this, 'begin']);
assert_false(this.matches(":defined"), "During construction, this should not match :defined");
assert_false(this.matches(":defined"), "During construction, after super(), this should not match :defined");
log.push([this, 'end']);
}
});
assert_true(instance.matches(":defined"), "After construction, instance should match :defined");
assert_equals(log.length, 2);
assert_array_equals(log[0], [instance, 'begin']);
assert_array_equals(log[1], [instance, 'end']);
Expand Down