diff --git a/custom-elements/pseudo-class-defined.html b/custom-elements/pseudo-class-defined.html index 60d88cffb517c0..24cb5fe4cd3922 100644 --- a/custom-elements/pseudo-class-defined.html +++ b/custom-elements/pseudo-class-defined.html @@ -90,4 +90,22 @@ assert_equals(style.color, expected ? defined : not_defined, 'getComputedStyle'); }, `${description} should ${expected ? 'be' : 'not be'} :defined`); } + +test(function () { + var log = []; + var instance = document.createElement('my-custom-element-2'); + document.body.appendChild(instance); + customElements.define('my-custom-element-2',class extends HTMLElement { + constructor() { + super(); + log.push([this, 'begin']); + assert_false(this.matches(":defined"), "During construction, this should not match :defined"); + log.push([this, 'end']); + } + }); + assert_equals(log.length, 2); + assert_array_equals(log[0], [instance, 'begin']); + assert_array_equals(log[1], [instance, 'end']); +}, 'this.matches(:defined) should not match during an upgrade'); + diff --git a/custom-elements/upgrading.html b/custom-elements/upgrading.html index d6b8ed387540ae..ac0fdff7a21115 100644 --- a/custom-elements/upgrading.html +++ b/custom-elements/upgrading.html @@ -12,6 +12,9 @@ + + +