95}, 'Upgrading a custom element must throw an TypeError when the returned element is not SameValue as the upgraded element');
96
97test(() => {
98 class NotAnElement extends HTMLElement {
99 constructor() {
100 return new Text();
101 }
102 }
103
104 let uncaughtError;
105 window.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
106 customElements.define("not-an-element", NotAnElement);
107 assert_equals(uncaughtError.name, "TypeError");
108}, "Upgrading a custom element whose constructor returns a Text node must throw");
109
110test(() => {
111 class NotAnHTMLElement extends HTMLElement {
112 constructor() {
113 return document.createElementNS("", "test");
114 }
115 }
116
117 let uncaughtError;
118 window.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
119 customElements.define("not-an-html-element", NotAnHTMLElement);
120 assert_equals(uncaughtError.name, "TypeError");
121}, "Upgrading a custom element whose constructor returns an Element must throw");