Commit 1c6d493b authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

custom-elements: Customized built-in elements should work in innerHTML.

HTMLConstructionSite should call CustomElementDefinition::
CreateElementAsync() if it's in fragment parsing mode.

- Separate HTMLElementFactory::createHTMLElement() into two.
  CreateElementAsync() uses the first part of separated functions.

Bug: 805280
Change-Id: I2e2dafcd33c033c87c3accaca7c1b00c56474591
Reviewed-on: https://chromium-review.googlesource.com/890680Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532308}
parent 8a854532
This is a testharness.js-based test.
Harness Error. harness_status.status = 1 , harness_status.message = Uncaught TypeError: Illegal constructor: localName does not match the HTML element interface
Found 442 tests; 307 PASS, 135 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 442 tests; 402 PASS, 40 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS a: Define a customized built-in element
PASS a: Operator 'new' should instantiate a customized built-in element
PASS a: document.createElement() should instantiate a customized built-in element
FAIL a: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyA extends HTMLAnchorElement {
constructor() {
super();
}
}" but got function "function HTMLAnchorElement() { [native code] }"
PASS a: innerHTML should instantiate a customized built-in element
PASS abbr: Define a customized built-in element
PASS abbr: Operator 'new' should instantiate a customized built-in element
PASS abbr: document.createElement() should instantiate a customized built-in element
FAIL abbr: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyAbbr extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS abbr: innerHTML should instantiate a customized built-in element
PASS address: Define a customized built-in element
PASS address: Operator 'new' should instantiate a customized built-in element
PASS address: document.createElement() should instantiate a customized built-in element
FAIL address: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyAddress extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS address: innerHTML should instantiate a customized built-in element
PASS area: Define a customized built-in element
PASS area: Operator 'new' should instantiate a customized built-in element
PASS area: document.createElement() should instantiate a customized built-in element
FAIL area: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyArea extends HTMLAreaElement {
constructor() {
super();
}
}" but got function "function HTMLAreaElement() { [native code] }"
PASS area: innerHTML should instantiate a customized built-in element
PASS article: Define a customized built-in element
PASS article: Operator 'new' should instantiate a customized built-in element
PASS article: document.createElement() should instantiate a customized built-in element
FAIL article: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyArticle extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS article: innerHTML should instantiate a customized built-in element
PASS aside: Define a customized built-in element
PASS aside: Operator 'new' should instantiate a customized built-in element
PASS aside: document.createElement() should instantiate a customized built-in element
FAIL aside: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyAside extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS aside: innerHTML should instantiate a customized built-in element
PASS audio: Define a customized built-in element
PASS audio: Operator 'new' should instantiate a customized built-in element
PASS audio: document.createElement() should instantiate a customized built-in element
FAIL audio: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyAudio extends HTMLAudioElement {
constructor() {
super();
}
}" but got function "function HTMLAudioElement() { [native code] }"
PASS audio: innerHTML should instantiate a customized built-in element
PASS b: Define a customized built-in element
PASS b: Operator 'new' should instantiate a customized built-in element
PASS b: document.createElement() should instantiate a customized built-in element
FAIL b: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyB extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS b: innerHTML should instantiate a customized built-in element
PASS base: Define a customized built-in element
PASS base: Operator 'new' should instantiate a customized built-in element
PASS base: document.createElement() should instantiate a customized built-in element
FAIL base: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyBase extends HTMLBaseElement {
constructor() {
super();
}
}" but got function "function HTMLBaseElement() { [native code] }"
PASS base: innerHTML should instantiate a customized built-in element
PASS bdi: Define a customized built-in element
FAIL bdi: Operator 'new' should instantiate a customized built-in element Illegal constructor: localName does not match the HTML element interface
FAIL bdi: document.createElement() should instantiate a customized built-in element assert_equals: expected function "class MyBdi extends HTMLElement {
......@@ -88,38 +52,22 @@ FAIL bdi: innerHTML should instantiate a customized built-in element assert_equa
PASS bdo: Define a customized built-in element
PASS bdo: Operator 'new' should instantiate a customized built-in element
PASS bdo: document.createElement() should instantiate a customized built-in element
FAIL bdo: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyBdo extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS bdo: innerHTML should instantiate a customized built-in element
PASS blockquote: Define a customized built-in element
PASS blockquote: Operator 'new' should instantiate a customized built-in element
PASS blockquote: document.createElement() should instantiate a customized built-in element
FAIL blockquote: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyBlockquote extends HTMLQuoteElement {
constructor() {
super();
}
}" but got function "function HTMLQuoteElement() { [native code] }"
PASS blockquote: innerHTML should instantiate a customized built-in element
PASS body: Define a customized built-in element
PASS body: Operator 'new' should instantiate a customized built-in element
PASS body: document.createElement() should instantiate a customized built-in element
PASS br: Define a customized built-in element
PASS br: Operator 'new' should instantiate a customized built-in element
PASS br: document.createElement() should instantiate a customized built-in element
FAIL br: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyBr extends HTMLBRElement {
constructor() {
super();
}
}" but got function "function HTMLBRElement() { [native code] }"
PASS br: innerHTML should instantiate a customized built-in element
PASS button: Define a customized built-in element
PASS button: Operator 'new' should instantiate a customized built-in element
PASS button: document.createElement() should instantiate a customized built-in element
FAIL button: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyButton extends HTMLButtonElement {
constructor() {
super();
}
}" but got function "function HTMLButtonElement() { [native code] }"
PASS button: innerHTML should instantiate a customized built-in element
PASS canvas: Define a customized built-in element
FAIL canvas: Operator 'new' should instantiate a customized built-in element Illegal constructor
FAIL canvas: document.createElement() should instantiate a customized built-in element assert_equals: expected function "class MyCanvas extends HTMLCanvasElement {
......@@ -135,115 +83,59 @@ FAIL canvas: innerHTML should instantiate a customized built-in element assert_e
PASS caption: Define a customized built-in element
PASS caption: Operator 'new' should instantiate a customized built-in element
PASS caption: document.createElement() should instantiate a customized built-in element
FAIL caption: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyCaption extends HTMLTableCaptionElement {
constructor() {
super();
}
}" but got function "function HTMLTableCaptionElement() { [native code] }"
PASS caption: innerHTML should instantiate a customized built-in element
PASS cite: Define a customized built-in element
PASS cite: Operator 'new' should instantiate a customized built-in element
PASS cite: document.createElement() should instantiate a customized built-in element
FAIL cite: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyCite extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS cite: innerHTML should instantiate a customized built-in element
PASS code: Define a customized built-in element
PASS code: Operator 'new' should instantiate a customized built-in element
PASS code: document.createElement() should instantiate a customized built-in element
FAIL code: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyCode extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS code: innerHTML should instantiate a customized built-in element
PASS col: Define a customized built-in element
PASS col: Operator 'new' should instantiate a customized built-in element
PASS col: document.createElement() should instantiate a customized built-in element
FAIL col: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyCol extends HTMLTableColElement {
constructor() {
super();
}
}" but got function "function HTMLTableColElement() { [native code] }"
PASS col: innerHTML should instantiate a customized built-in element
PASS colgroup: Define a customized built-in element
PASS colgroup: Operator 'new' should instantiate a customized built-in element
PASS colgroup: document.createElement() should instantiate a customized built-in element
FAIL colgroup: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyColgroup extends HTMLTableColElement {
constructor() {
super();
}
}" but got function "function HTMLTableColElement() { [native code] }"
PASS colgroup: innerHTML should instantiate a customized built-in element
PASS data: Define a customized built-in element
PASS data: Operator 'new' should instantiate a customized built-in element
PASS data: document.createElement() should instantiate a customized built-in element
FAIL data: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyData extends HTMLDataElement {
constructor() {
super();
}
}" but got function "function HTMLDataElement() { [native code] }"
PASS data: innerHTML should instantiate a customized built-in element
PASS dd: Define a customized built-in element
PASS dd: Operator 'new' should instantiate a customized built-in element
PASS dd: document.createElement() should instantiate a customized built-in element
FAIL dd: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyDd extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS dd: innerHTML should instantiate a customized built-in element
PASS del: Define a customized built-in element
PASS del: Operator 'new' should instantiate a customized built-in element
PASS del: document.createElement() should instantiate a customized built-in element
FAIL del: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyDel extends HTMLModElement {
constructor() {
super();
}
}" but got function "function HTMLModElement() { [native code] }"
PASS del: innerHTML should instantiate a customized built-in element
PASS details: Define a customized built-in element
PASS details: Operator 'new' should instantiate a customized built-in element
PASS details: document.createElement() should instantiate a customized built-in element
FAIL details: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyDetails extends HTMLDetailsElement {
constructor() {
super();
}
}" but got function "function HTMLDetailsElement() { [native code] }"
PASS details: innerHTML should instantiate a customized built-in element
PASS dfn: Define a customized built-in element
PASS dfn: Operator 'new' should instantiate a customized built-in element
PASS dfn: document.createElement() should instantiate a customized built-in element
FAIL dfn: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyDfn extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS dfn: innerHTML should instantiate a customized built-in element
PASS div: Define a customized built-in element
PASS div: Operator 'new' should instantiate a customized built-in element
PASS div: document.createElement() should instantiate a customized built-in element
FAIL div: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyDiv extends HTMLDivElement {
constructor() {
super();
}
}" but got function "function HTMLDivElement() { [native code] }"
PASS div: innerHTML should instantiate a customized built-in element
PASS dl: Define a customized built-in element
PASS dl: Operator 'new' should instantiate a customized built-in element
PASS dl: document.createElement() should instantiate a customized built-in element
FAIL dl: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyDl extends HTMLDListElement {
constructor() {
super();
}
}" but got function "function HTMLDListElement() { [native code] }"
PASS dl: innerHTML should instantiate a customized built-in element
PASS dt: Define a customized built-in element
PASS dt: Operator 'new' should instantiate a customized built-in element
PASS dt: document.createElement() should instantiate a customized built-in element
FAIL dt: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyDt extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS dt: innerHTML should instantiate a customized built-in element
PASS em: Define a customized built-in element
PASS em: Operator 'new' should instantiate a customized built-in element
PASS em: document.createElement() should instantiate a customized built-in element
FAIL em: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyEm extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS em: innerHTML should instantiate a customized built-in element
PASS embed: Define a customized built-in element
FAIL embed: Operator 'new' should instantiate a customized built-in element Illegal constructor
FAIL embed: document.createElement() should instantiate a customized built-in element assert_equals: expected function "class MyEmbed extends HTMLEmbedElement {
......@@ -259,35 +151,19 @@ FAIL embed: innerHTML should instantiate a customized built-in element assert_eq
PASS fieldset: Define a customized built-in element
PASS fieldset: Operator 'new' should instantiate a customized built-in element
PASS fieldset: document.createElement() should instantiate a customized built-in element
FAIL fieldset: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyFieldset extends HTMLFieldSetElement {
constructor() {
super();
}
}" but got function "function HTMLFieldSetElement() { [native code] }"
PASS fieldset: innerHTML should instantiate a customized built-in element
PASS figcaption: Define a customized built-in element
PASS figcaption: Operator 'new' should instantiate a customized built-in element
PASS figcaption: document.createElement() should instantiate a customized built-in element
FAIL figcaption: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyFigcaption extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS figcaption: innerHTML should instantiate a customized built-in element
PASS figure: Define a customized built-in element
PASS figure: Operator 'new' should instantiate a customized built-in element
PASS figure: document.createElement() should instantiate a customized built-in element
FAIL figure: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyFigure extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS figure: innerHTML should instantiate a customized built-in element
PASS footer: Define a customized built-in element
PASS footer: Operator 'new' should instantiate a customized built-in element
PASS footer: document.createElement() should instantiate a customized built-in element
FAIL footer: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyFooter extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS footer: innerHTML should instantiate a customized built-in element
PASS form: Define a customized built-in element
FAIL form: Operator 'new' should instantiate a customized built-in element Illegal constructor
FAIL form: document.createElement() should instantiate a customized built-in element assert_equals: expected function "class MyForm extends HTMLFormElement {
......@@ -303,86 +179,46 @@ FAIL form: innerHTML should instantiate a customized built-in element assert_equ
PASS h1: Define a customized built-in element
PASS h1: Operator 'new' should instantiate a customized built-in element
PASS h1: document.createElement() should instantiate a customized built-in element
FAIL h1: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyH1 extends HTMLHeadingElement {
constructor() {
super();
}
}" but got function "function HTMLHeadingElement() { [native code] }"
PASS h1: innerHTML should instantiate a customized built-in element
PASS h2: Define a customized built-in element
PASS h2: Operator 'new' should instantiate a customized built-in element
PASS h2: document.createElement() should instantiate a customized built-in element
FAIL h2: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyH2 extends HTMLHeadingElement {
constructor() {
super();
}
}" but got function "function HTMLHeadingElement() { [native code] }"
PASS h2: innerHTML should instantiate a customized built-in element
PASS h3: Define a customized built-in element
PASS h3: Operator 'new' should instantiate a customized built-in element
PASS h3: document.createElement() should instantiate a customized built-in element
FAIL h3: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyH3 extends HTMLHeadingElement {
constructor() {
super();
}
}" but got function "function HTMLHeadingElement() { [native code] }"
PASS h3: innerHTML should instantiate a customized built-in element
PASS h4: Define a customized built-in element
PASS h4: Operator 'new' should instantiate a customized built-in element
PASS h4: document.createElement() should instantiate a customized built-in element
FAIL h4: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyH4 extends HTMLHeadingElement {
constructor() {
super();
}
}" but got function "function HTMLHeadingElement() { [native code] }"
PASS h4: innerHTML should instantiate a customized built-in element
PASS h5: Define a customized built-in element
PASS h5: Operator 'new' should instantiate a customized built-in element
PASS h5: document.createElement() should instantiate a customized built-in element
FAIL h5: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyH5 extends HTMLHeadingElement {
constructor() {
super();
}
}" but got function "function HTMLHeadingElement() { [native code] }"
PASS h5: innerHTML should instantiate a customized built-in element
PASS h6: Define a customized built-in element
PASS h6: Operator 'new' should instantiate a customized built-in element
PASS h6: document.createElement() should instantiate a customized built-in element
FAIL h6: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyH6 extends HTMLHeadingElement {
constructor() {
super();
}
}" but got function "function HTMLHeadingElement() { [native code] }"
PASS h6: innerHTML should instantiate a customized built-in element
PASS header: Define a customized built-in element
PASS header: Operator 'new' should instantiate a customized built-in element
PASS header: document.createElement() should instantiate a customized built-in element
FAIL header: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyHeader extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS header: innerHTML should instantiate a customized built-in element
PASS hgroup: Define a customized built-in element
PASS hgroup: Operator 'new' should instantiate a customized built-in element
PASS hgroup: document.createElement() should instantiate a customized built-in element
FAIL hgroup: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyHgroup extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS hgroup: innerHTML should instantiate a customized built-in element
PASS hr: Define a customized built-in element
PASS hr: Operator 'new' should instantiate a customized built-in element
PASS hr: document.createElement() should instantiate a customized built-in element
FAIL hr: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyHr extends HTMLHRElement {
constructor() {
super();
}
}" but got function "function HTMLHRElement() { [native code] }"
PASS hr: innerHTML should instantiate a customized built-in element
PASS html: Define a customized built-in element
PASS html: Operator 'new' should instantiate a customized built-in element
PASS html: document.createElement() should instantiate a customized built-in element
PASS i: Define a customized built-in element
PASS i: Operator 'new' should instantiate a customized built-in element
PASS i: document.createElement() should instantiate a customized built-in element
FAIL i: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyI extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS i: innerHTML should instantiate a customized built-in element
PASS iframe: Define a customized built-in element
FAIL iframe: Operator 'new' should instantiate a customized built-in element Illegal constructor
FAIL iframe: document.createElement() should instantiate a customized built-in element assert_equals: expected function "class MyIframe extends HTMLIFrameElement {
......@@ -398,11 +234,7 @@ FAIL iframe: innerHTML should instantiate a customized built-in element assert_e
PASS img: Define a customized built-in element
PASS img: Operator 'new' should instantiate a customized built-in element
PASS img: document.createElement() should instantiate a customized built-in element
FAIL img: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyImg extends HTMLImageElement {
constructor() {
super();
}
}" but got function "function HTMLImageElement() { [native code] }"
PASS img: innerHTML should instantiate a customized built-in element
PASS input: Define a customized built-in element
FAIL input: Operator 'new' should instantiate a customized built-in element Illegal constructor
FAIL input: document.createElement() should instantiate a customized built-in element assert_equals: expected function "class MyInput extends HTMLInputElement {
......@@ -418,107 +250,55 @@ FAIL input: innerHTML should instantiate a customized built-in element assert_eq
PASS ins: Define a customized built-in element
PASS ins: Operator 'new' should instantiate a customized built-in element
PASS ins: document.createElement() should instantiate a customized built-in element
FAIL ins: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyIns extends HTMLModElement {
constructor() {
super();
}
}" but got function "function HTMLModElement() { [native code] }"
PASS ins: innerHTML should instantiate a customized built-in element
PASS kbd: Define a customized built-in element
PASS kbd: Operator 'new' should instantiate a customized built-in element
PASS kbd: document.createElement() should instantiate a customized built-in element
FAIL kbd: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyKbd extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS kbd: innerHTML should instantiate a customized built-in element
PASS label: Define a customized built-in element
PASS label: Operator 'new' should instantiate a customized built-in element
PASS label: document.createElement() should instantiate a customized built-in element
FAIL label: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyLabel extends HTMLLabelElement {
constructor() {
super();
}
}" but got function "function HTMLLabelElement() { [native code] }"
PASS label: innerHTML should instantiate a customized built-in element
PASS legend: Define a customized built-in element
PASS legend: Operator 'new' should instantiate a customized built-in element
PASS legend: document.createElement() should instantiate a customized built-in element
FAIL legend: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyLegend extends HTMLLegendElement {
constructor() {
super();
}
}" but got function "function HTMLLegendElement() { [native code] }"
PASS legend: innerHTML should instantiate a customized built-in element
PASS li: Define a customized built-in element
PASS li: Operator 'new' should instantiate a customized built-in element
PASS li: document.createElement() should instantiate a customized built-in element
FAIL li: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyLi extends HTMLLIElement {
constructor() {
super();
}
}" but got function "function HTMLLIElement() { [native code] }"
PASS li: innerHTML should instantiate a customized built-in element
PASS link: Define a customized built-in element
PASS link: Operator 'new' should instantiate a customized built-in element
PASS link: document.createElement() should instantiate a customized built-in element
FAIL link: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyLink extends HTMLLinkElement {
constructor() {
super();
}
}" but got function "function HTMLLinkElement() { [native code] }"
PASS link: innerHTML should instantiate a customized built-in element
PASS main: Define a customized built-in element
PASS main: Operator 'new' should instantiate a customized built-in element
PASS main: document.createElement() should instantiate a customized built-in element
FAIL main: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyMain extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS main: innerHTML should instantiate a customized built-in element
PASS map: Define a customized built-in element
PASS map: Operator 'new' should instantiate a customized built-in element
PASS map: document.createElement() should instantiate a customized built-in element
FAIL map: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyMap extends HTMLMapElement {
constructor() {
super();
}
}" but got function "function HTMLMapElement() { [native code] }"
PASS map: innerHTML should instantiate a customized built-in element
PASS mark: Define a customized built-in element
PASS mark: Operator 'new' should instantiate a customized built-in element
PASS mark: document.createElement() should instantiate a customized built-in element
FAIL mark: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyMark extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS mark: innerHTML should instantiate a customized built-in element
PASS menu: Define a customized built-in element
PASS menu: Operator 'new' should instantiate a customized built-in element
PASS menu: document.createElement() should instantiate a customized built-in element
FAIL menu: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyMenu extends HTMLMenuElement {
constructor() {
super();
}
}" but got function "function HTMLMenuElement() { [native code] }"
PASS menu: innerHTML should instantiate a customized built-in element
PASS meta: Define a customized built-in element
PASS meta: Operator 'new' should instantiate a customized built-in element
PASS meta: document.createElement() should instantiate a customized built-in element
FAIL meta: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyMeta extends HTMLMetaElement {
constructor() {
super();
}
}" but got function "function HTMLMetaElement() { [native code] }"
PASS meta: innerHTML should instantiate a customized built-in element
PASS meter: Define a customized built-in element
PASS meter: Operator 'new' should instantiate a customized built-in element
PASS meter: document.createElement() should instantiate a customized built-in element
FAIL meter: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyMeter extends HTMLMeterElement {
constructor() {
super();
}
}" but got function "function HTMLMeterElement() { [native code] }"
PASS meter: innerHTML should instantiate a customized built-in element
PASS nav: Define a customized built-in element
PASS nav: Operator 'new' should instantiate a customized built-in element
PASS nav: document.createElement() should instantiate a customized built-in element
FAIL nav: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyNav extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS nav: innerHTML should instantiate a customized built-in element
PASS noscript: Define a customized built-in element
FAIL noscript: Operator 'new' should instantiate a customized built-in element Illegal constructor: localName does not match the HTML element interface
FAIL noscript: document.createElement() should instantiate a customized built-in element assert_equals: expected function "class MyNoscript extends HTMLElement {
......@@ -546,91 +326,47 @@ FAIL object: innerHTML should instantiate a customized built-in element assert_e
PASS ol: Define a customized built-in element
PASS ol: Operator 'new' should instantiate a customized built-in element
PASS ol: document.createElement() should instantiate a customized built-in element
FAIL ol: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyOl extends HTMLOListElement {
constructor() {
super();
}
}" but got function "function HTMLOListElement() { [native code] }"
PASS ol: innerHTML should instantiate a customized built-in element
PASS optgroup: Define a customized built-in element
PASS optgroup: Operator 'new' should instantiate a customized built-in element
PASS optgroup: document.createElement() should instantiate a customized built-in element
FAIL optgroup: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyOptgroup extends HTMLOptGroupElement {
constructor() {
super();
}
}" but got function "function HTMLOptGroupElement() { [native code] }"
PASS optgroup: innerHTML should instantiate a customized built-in element
PASS option: Define a customized built-in element
PASS option: Operator 'new' should instantiate a customized built-in element
PASS option: document.createElement() should instantiate a customized built-in element
FAIL option: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyOption extends HTMLOptionElement {
constructor() {
super();
}
}" but got function "function HTMLOptionElement() { [native code] }"
PASS option: innerHTML should instantiate a customized built-in element
PASS output: Define a customized built-in element
PASS output: Operator 'new' should instantiate a customized built-in element
PASS output: document.createElement() should instantiate a customized built-in element
FAIL output: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyOutput extends HTMLOutputElement {
constructor() {
super();
}
}" but got function "function HTMLOutputElement() { [native code] }"
PASS output: innerHTML should instantiate a customized built-in element
PASS p: Define a customized built-in element
PASS p: Operator 'new' should instantiate a customized built-in element
PASS p: document.createElement() should instantiate a customized built-in element
FAIL p: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyP extends HTMLParagraphElement {
constructor() {
super();
}
}" but got function "function HTMLParagraphElement() { [native code] }"
PASS p: innerHTML should instantiate a customized built-in element
PASS param: Define a customized built-in element
PASS param: Operator 'new' should instantiate a customized built-in element
PASS param: document.createElement() should instantiate a customized built-in element
FAIL param: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyParam extends HTMLParamElement {
constructor() {
super();
}
}" but got function "function HTMLParamElement() { [native code] }"
PASS param: innerHTML should instantiate a customized built-in element
PASS picture: Define a customized built-in element
PASS picture: Operator 'new' should instantiate a customized built-in element
PASS picture: document.createElement() should instantiate a customized built-in element
FAIL picture: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyPicture extends HTMLPictureElement {
constructor() {
super();
}
}" but got function "function HTMLPictureElement() { [native code] }"
PASS picture: innerHTML should instantiate a customized built-in element
PASS pre: Define a customized built-in element
PASS pre: Operator 'new' should instantiate a customized built-in element
PASS pre: document.createElement() should instantiate a customized built-in element
FAIL pre: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyPre extends HTMLPreElement {
constructor() {
super();
}
}" but got function "function HTMLPreElement() { [native code] }"
PASS pre: innerHTML should instantiate a customized built-in element
PASS progress: Define a customized built-in element
PASS progress: Operator 'new' should instantiate a customized built-in element
PASS progress: document.createElement() should instantiate a customized built-in element
FAIL progress: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyProgress extends HTMLProgressElement {
constructor() {
super();
}
}" but got function "function HTMLProgressElement() { [native code] }"
PASS progress: innerHTML should instantiate a customized built-in element
PASS q: Define a customized built-in element
PASS q: Operator 'new' should instantiate a customized built-in element
PASS q: document.createElement() should instantiate a customized built-in element
FAIL q: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyQ extends HTMLQuoteElement {
constructor() {
super();
}
}" but got function "function HTMLQuoteElement() { [native code] }"
PASS q: innerHTML should instantiate a customized built-in element
PASS rp: Define a customized built-in element
PASS rp: Operator 'new' should instantiate a customized built-in element
PASS rp: document.createElement() should instantiate a customized built-in element
FAIL rp: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyRp extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS rp: innerHTML should instantiate a customized built-in element
PASS rt: Define a customized built-in element
FAIL rt: Operator 'new' should instantiate a customized built-in element Illegal constructor: localName does not match the HTML element interface
FAIL rt: document.createElement() should instantiate a customized built-in element assert_equals: expected function "class MyRt extends HTMLElement {
......@@ -658,19 +394,11 @@ FAIL ruby: innerHTML should instantiate a customized built-in element assert_equ
PASS s: Define a customized built-in element
PASS s: Operator 'new' should instantiate a customized built-in element
PASS s: document.createElement() should instantiate a customized built-in element
FAIL s: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyS extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS s: innerHTML should instantiate a customized built-in element
PASS samp: Define a customized built-in element
PASS samp: Operator 'new' should instantiate a customized built-in element
PASS samp: document.createElement() should instantiate a customized built-in element
FAIL samp: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MySamp extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS samp: innerHTML should instantiate a customized built-in element
PASS script: Define a customized built-in element
PASS script: Operator 'new' should instantiate a customized built-in element
PASS script: document.createElement() should instantiate a customized built-in element
......@@ -682,67 +410,35 @@ FAIL script: innerHTML should instantiate a customized built-in element assert_e
PASS section: Define a customized built-in element
PASS section: Operator 'new' should instantiate a customized built-in element
PASS section: document.createElement() should instantiate a customized built-in element
FAIL section: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MySection extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS section: innerHTML should instantiate a customized built-in element
PASS select: Define a customized built-in element
PASS select: Operator 'new' should instantiate a customized built-in element
PASS select: document.createElement() should instantiate a customized built-in element
FAIL select: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MySelect extends HTMLSelectElement {
constructor() {
super();
}
}" but got function "function HTMLSelectElement() { [native code] }"
PASS select: innerHTML should instantiate a customized built-in element
PASS small: Define a customized built-in element
PASS small: Operator 'new' should instantiate a customized built-in element
PASS small: document.createElement() should instantiate a customized built-in element
FAIL small: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MySmall extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS small: innerHTML should instantiate a customized built-in element
PASS source: Define a customized built-in element
PASS source: Operator 'new' should instantiate a customized built-in element
PASS source: document.createElement() should instantiate a customized built-in element
FAIL source: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MySource extends HTMLSourceElement {
constructor() {
super();
}
}" but got function "function HTMLSourceElement() { [native code] }"
PASS source: innerHTML should instantiate a customized built-in element
PASS span: Define a customized built-in element
PASS span: Operator 'new' should instantiate a customized built-in element
PASS span: document.createElement() should instantiate a customized built-in element
FAIL span: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MySpan extends HTMLSpanElement {
constructor() {
super();
}
}" but got function "function HTMLSpanElement() { [native code] }"
PASS span: innerHTML should instantiate a customized built-in element
PASS strong: Define a customized built-in element
PASS strong: Operator 'new' should instantiate a customized built-in element
PASS strong: document.createElement() should instantiate a customized built-in element
FAIL strong: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyStrong extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS strong: innerHTML should instantiate a customized built-in element
PASS style: Define a customized built-in element
PASS style: Operator 'new' should instantiate a customized built-in element
PASS style: document.createElement() should instantiate a customized built-in element
FAIL style: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyStyle extends HTMLStyleElement {
constructor() {
super();
}
}" but got function "function HTMLStyleElement() { [native code] }"
PASS style: innerHTML should instantiate a customized built-in element
PASS sub: Define a customized built-in element
PASS sub: Operator 'new' should instantiate a customized built-in element
PASS sub: document.createElement() should instantiate a customized built-in element
FAIL sub: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MySub extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS sub: innerHTML should instantiate a customized built-in element
PASS summary: Define a customized built-in element
FAIL summary: Operator 'new' should instantiate a customized built-in element Illegal constructor: localName does not match the HTML element interface
FAIL summary: document.createElement() should instantiate a customized built-in element assert_equals: expected function "class MySummary extends HTMLElement {
......@@ -758,131 +454,67 @@ FAIL summary: innerHTML should instantiate a customized built-in element assert_
PASS sup: Define a customized built-in element
PASS sup: Operator 'new' should instantiate a customized built-in element
PASS sup: document.createElement() should instantiate a customized built-in element
FAIL sup: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MySup extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS sup: innerHTML should instantiate a customized built-in element
PASS table: Define a customized built-in element
PASS table: Operator 'new' should instantiate a customized built-in element
PASS table: document.createElement() should instantiate a customized built-in element
FAIL table: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTable extends HTMLTableElement {
constructor() {
super();
}
}" but got function "function HTMLTableElement() { [native code] }"
PASS table: innerHTML should instantiate a customized built-in element
PASS tbody: Define a customized built-in element
PASS tbody: Operator 'new' should instantiate a customized built-in element
PASS tbody: document.createElement() should instantiate a customized built-in element
FAIL tbody: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTbody extends HTMLTableSectionElement {
constructor() {
super();
}
}" but got function "function HTMLTableSectionElement() { [native code] }"
PASS tbody: innerHTML should instantiate a customized built-in element
PASS td: Define a customized built-in element
PASS td: Operator 'new' should instantiate a customized built-in element
PASS td: document.createElement() should instantiate a customized built-in element
FAIL td: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTd extends HTMLTableCellElement {
constructor() {
super();
}
}" but got function "function HTMLTableCellElement() { [native code] }"
PASS td: innerHTML should instantiate a customized built-in element
PASS template: Define a customized built-in element
PASS template: Operator 'new' should instantiate a customized built-in element
PASS template: document.createElement() should instantiate a customized built-in element
FAIL template: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTemplate extends HTMLTemplateElement {
constructor() {
super();
}
}" but got function "function HTMLTemplateElement() { [native code] }"
PASS template: innerHTML should instantiate a customized built-in element
PASS textarea: Define a customized built-in element
PASS textarea: Operator 'new' should instantiate a customized built-in element
PASS textarea: document.createElement() should instantiate a customized built-in element
FAIL textarea: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTextarea extends HTMLTextAreaElement {
constructor() {
super();
}
}" but got function "function HTMLTextAreaElement() { [native code] }"
PASS textarea: innerHTML should instantiate a customized built-in element
PASS tfoot: Define a customized built-in element
PASS tfoot: Operator 'new' should instantiate a customized built-in element
PASS tfoot: document.createElement() should instantiate a customized built-in element
FAIL tfoot: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTfoot extends HTMLTableSectionElement {
constructor() {
super();
}
}" but got function "function HTMLTableSectionElement() { [native code] }"
PASS tfoot: innerHTML should instantiate a customized built-in element
PASS th: Define a customized built-in element
PASS th: Operator 'new' should instantiate a customized built-in element
PASS th: document.createElement() should instantiate a customized built-in element
FAIL th: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTh extends HTMLTableCellElement {
constructor() {
super();
}
}" but got function "function HTMLTableCellElement() { [native code] }"
PASS th: innerHTML should instantiate a customized built-in element
PASS thead: Define a customized built-in element
PASS thead: Operator 'new' should instantiate a customized built-in element
PASS thead: document.createElement() should instantiate a customized built-in element
FAIL thead: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyThead extends HTMLTableSectionElement {
constructor() {
super();
}
}" but got function "function HTMLTableSectionElement() { [native code] }"
PASS thead: innerHTML should instantiate a customized built-in element
PASS time: Define a customized built-in element
PASS time: Operator 'new' should instantiate a customized built-in element
PASS time: document.createElement() should instantiate a customized built-in element
FAIL time: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTime extends HTMLTimeElement {
constructor() {
super();
}
}" but got function "function HTMLTimeElement() { [native code] }"
PASS time: innerHTML should instantiate a customized built-in element
PASS title: Define a customized built-in element
PASS title: Operator 'new' should instantiate a customized built-in element
PASS title: document.createElement() should instantiate a customized built-in element
FAIL title: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTitle extends HTMLTitleElement {
constructor() {
super();
}
}" but got function "function HTMLTitleElement() { [native code] }"
PASS title: innerHTML should instantiate a customized built-in element
PASS tr: Define a customized built-in element
PASS tr: Operator 'new' should instantiate a customized built-in element
PASS tr: document.createElement() should instantiate a customized built-in element
FAIL tr: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTr extends HTMLTableRowElement {
constructor() {
super();
}
}" but got function "function HTMLTableRowElement() { [native code] }"
PASS tr: innerHTML should instantiate a customized built-in element
PASS track: Define a customized built-in element
PASS track: Operator 'new' should instantiate a customized built-in element
PASS track: document.createElement() should instantiate a customized built-in element
FAIL track: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyTrack extends HTMLTrackElement {
constructor() {
super();
}
}" but got function "function HTMLTrackElement() { [native code] }"
PASS track: innerHTML should instantiate a customized built-in element
PASS u: Define a customized built-in element
PASS u: Operator 'new' should instantiate a customized built-in element
PASS u: document.createElement() should instantiate a customized built-in element
FAIL u: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyU extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS u: innerHTML should instantiate a customized built-in element
PASS ul: Define a customized built-in element
PASS ul: Operator 'new' should instantiate a customized built-in element
PASS ul: document.createElement() should instantiate a customized built-in element
FAIL ul: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyUl extends HTMLUListElement {
constructor() {
super();
}
}" but got function "function HTMLUListElement() { [native code] }"
PASS ul: innerHTML should instantiate a customized built-in element
PASS var: Define a customized built-in element
PASS var: Operator 'new' should instantiate a customized built-in element
PASS var: document.createElement() should instantiate a customized built-in element
FAIL var: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyVar extends HTMLElement {
constructor() {
super();
}
}" but got function "function HTMLElement() { [native code] }"
PASS var: innerHTML should instantiate a customized built-in element
PASS video: Define a customized built-in element
FAIL video: Operator 'new' should instantiate a customized built-in element Illegal constructor
FAIL video: document.createElement() should instantiate a customized built-in element assert_equals: expected function "class MyVideo extends HTMLVideoElement {
......@@ -910,26 +542,14 @@ FAIL wbr: innerHTML should instantiate a customized built-in element assert_equa
PASS datalist: Define a customized built-in element
PASS datalist: Operator 'new' should instantiate a customized built-in element
PASS datalist: document.createElement() should instantiate a customized built-in element
FAIL datalist: innerHTML should instantiate a customized built-in element assert_equals: expected function "class extends HTMLDataListElement {
constructor() {
super();
}
}" but got function "function HTMLDataListElement() { [native code] }"
PASS datalist: innerHTML should instantiate a customized built-in element
PASS dialog: Define a customized built-in element
PASS dialog: Operator 'new' should instantiate a customized built-in element
PASS dialog: document.createElement() should instantiate a customized built-in element
FAIL dialog: innerHTML should instantiate a customized built-in element assert_equals: expected function "class MyDialog extends HTMLDialogElement {
constructor() {
super();
}
}" but got function "function HTMLDialogElement() { [native code] }"
PASS dialog: innerHTML should instantiate a customized built-in element
PASS slot: Define a customized built-in element
PASS slot: Operator 'new' should instantiate a customized built-in element
PASS slot: document.createElement() should instantiate a customized built-in element
FAIL slot: innerHTML should instantiate a customized built-in element assert_equals: expected function "class extends HTMLSlotElement {
constructor() {
super();
}
}" but got function "function HTMLSlotElement() { [native code] }"
PASS slot: innerHTML should instantiate a customized built-in element
Harness: the test ran to completion.
......@@ -67,7 +67,7 @@ static void create{{namespace}}FunctionMap() {
g_{{namespace}}_constructors->Set(data[i].tag.LocalName(), data[i].func);
}
{{namespace}}Element* {{namespace}}ElementFactory::create{{namespace}}Element(
{{namespace}}Element* {{namespace}}ElementFactory::CreateRaw{{namespace}}Element(
const AtomicString& localName,
Document& document,
CreateElementFlags flags) {
......@@ -75,6 +75,15 @@ static void create{{namespace}}FunctionMap() {
create{{namespace}}FunctionMap();
if ({{namespace}}ConstructorFunction function = g_{{namespace}}_constructors->at(localName))
return function(document, flags);
return nullptr;
}
{{namespace}}Element* {{namespace}}ElementFactory::create{{namespace}}Element(
const AtomicString& localName,
Document& document,
CreateElementFlags flags) {
if (auto* element = {{namespace}}ElementFactory::CreateRaw{{namespace}}Element(localName, document, flags))
return element;
{% if namespace == 'HTML' %}
// createElement handles custom element creation itself in order to
......@@ -85,7 +94,7 @@ static void create{{namespace}}FunctionMap() {
if (flags != kCreatedByCreateElement && CustomElement::ShouldCreateCustomElement(localName)) {
QualifiedName tagName(g_null_atom, localName, HTMLNames::xhtmlNamespaceURI);
if (flags & kAsynchronousCustomElements)
return CustomElement::CreateCustomElementAsync(document, tagName);
return CustomElement::CreateCustomElementAsync(document, tagName, flags);
return CustomElement::CreateCustomElementSync(document, tagName);
}
{% endif %}
......
......@@ -6,18 +6,24 @@
#ifndef BLINK_CORE_{{namespace|upper}}_ELEMENT_FACTORY_H_
#define BLINK_CORE_{{namespace|upper}}_ELEMENT_FACTORY_H_
#include "core/dom/Document.h"
#include "core/dom/CreateElementFlags.h"
#include "platform/wtf/Forward.h"
namespace blink {
class Document;
class {{namespace}}Element;
{% if namespace == 'HTML' %}
class HTMLFormElement;
{% endif %}
class {{namespace}}ElementFactory {
public:
// If |localName| is unknown, nullptr is returned.
static {{namespace}}Element* CreateRaw{{namespace}}Element(
const AtomicString& localName,
Document&,
CreateElementFlags flags);
// CreateRaw{{namespace}}Element() + custom element processing.
// If |localName| is unknown, a {{fallback_interface}} instance is returned.
static {{namespace}}Element* create{{namespace}}Element(
const AtomicString& localName,
Document&,
......
......@@ -138,7 +138,8 @@ HTMLElement* CustomElement::CreateCustomElementSync(
HTMLElement* CustomElement::CreateCustomElementAsync(
Document& document,
const QualifiedName& tag_name) {
const QualifiedName& tag_name,
CreateElementFlags flags) {
DCHECK(ShouldCreateCustomElement(tag_name));
// To create an element:
......@@ -148,7 +149,7 @@ HTMLElement* CustomElement::CreateCustomElementAsync(
if (CustomElementDefinition* definition = DefinitionFor(
document,
CustomElementDescriptor(tag_name.LocalName(), tag_name.LocalName())))
return definition->CreateElementAsync(document, tag_name);
return definition->CreateElementAsync(document, tag_name, flags);
return CreateUndefinedElement(document, tag_name);
}
......@@ -257,8 +258,11 @@ void CustomElement::TryToUpgrade(Element* element) {
CustomElementRegistry* registry = CustomElement::Registry(*element);
if (!registry)
return;
if (CustomElementDefinition* definition = registry->DefinitionFor(
CustomElementDescriptor(element->localName(), element->localName())))
const AtomicString& is_value = element->FastGetAttribute(HTMLNames::isAttr);
if (CustomElementDefinition* definition =
registry->DefinitionFor(CustomElementDescriptor(
is_value.IsNull() ? element->localName() : is_value,
element->localName())))
definition->EnqueueUpgradeReaction(element);
else
registry->AddCandidate(element);
......
......@@ -6,6 +6,7 @@
#define CustomElement_h
#include "core/CoreExport.h"
#include "core/dom/CreateElementFlags.h"
#include "core/dom/Element.h"
#include "platform/text/Character.h"
#include "platform/wtf/ASCIICType.h"
......@@ -74,7 +75,9 @@ class CORE_EXPORT CustomElement {
static HTMLElement* CreateCustomElementSync(Document&,
const QualifiedName&,
CustomElementDefinition*);
static HTMLElement* CreateCustomElementAsync(Document&, const QualifiedName&);
static HTMLElement* CreateCustomElementAsync(Document&,
const QualifiedName&,
CreateElementFlags);
static HTMLElement* CreateFailedElement(Document&, const QualifiedName&);
......
......@@ -16,6 +16,7 @@
#include "core/html/custom/CustomElementReaction.h"
#include "core/html/custom/CustomElementReactionStack.h"
#include "core/html/custom/CustomElementUpgradeReaction.h"
#include "core/html_element_factory.h"
namespace blink {
......@@ -106,8 +107,30 @@ HTMLElement* CustomElementDefinition::CreateElementForConstructor(
HTMLElement* CustomElementDefinition::CreateElementAsync(
Document& document,
const QualifiedName& tag_name) {
const QualifiedName& tag_name,
CreateElementFlags flags) {
// https://dom.spec.whatwg.org/#concept-create-element
// 5. If definition is non-null, and definition’s name is not equal to
// its local name (i.e., definition represents a customized built-in
// element), then:
if (!descriptor_.IsAutonomous()) {
// 5.1. Let interface be the element interface for localName and the
// HTML namespace.
// 5.2. Set result to a new element that implements interface, with
// no attributes, namespace set to the HTML namespace, namespace
// prefix set to prefix, local name set to localName, custom element
// state set to "undefined", custom element definition set to null,
// is value set to is, and node document set to document.
auto* result = HTMLElementFactory::CreateRawHTMLElement(
tag_name.LocalName(), document, flags);
result->SetCustomElementState(CustomElementState::kUndefined);
// 5.4. Otherwise, enqueue a custom element upgrade reaction given
// result and definition.
EnqueueUpgradeReaction(result);
return result;
}
// 6. If definition is non-null, then:
// 6.2. If the synchronous custom elements flag is not set:
// 6.2.1. Set result to a new element that implements the HTMLElement
......
......@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "bindings/core/v8/ScriptValue.h"
#include "core/CoreExport.h"
#include "core/dom/CreateElementFlags.h"
#include "core/html/custom/CustomElementDescriptor.h"
#include "platform/bindings/ScriptWrappable.h" // For TraceWrapperBase
#include "platform/heap/Handle.h"
......@@ -54,7 +55,9 @@ class CORE_EXPORT CustomElementDefinition
HTMLElement* CreateElementForConstructor(Document&);
virtual HTMLElement* CreateElementSync(Document&, const QualifiedName&) = 0;
HTMLElement* CreateElementAsync(Document&, const QualifiedName&);
HTMLElement* CreateElementAsync(Document&,
const QualifiedName&,
CreateElementFlags);
void Upgrade(Element*);
......
......@@ -870,9 +870,7 @@ Element* HTMLConstructionSite::CreateElement(
QualifiedName tag_name(g_null_atom, token->GetName(), namespace_uri);
// "3. Let is be the value of the "is" attribute in the given token ..." etc.
// "4. Let definition be the result of looking up a custom element ..." etc.
CustomElementDefinition* definition =
is_parsing_fragment_ ? nullptr
: LookUpCustomElementDefinition(document, token);
auto* definition = LookUpCustomElementDefinition(document, token);
// "5. If definition is non-null and the parser was not originally created
// for the HTML fragment parsing algorithm, then let will execute script
// be true."
......@@ -911,7 +909,12 @@ Element* HTMLConstructionSite::CreateElement(
// and ThrowOnDynamicMarkupInsertionCountIncrementer destructors implement
// steps 9.1-3.
} else {
element = document.createElement(tag_name, GetCreateElementFlags());
if (definition) {
element = definition->CreateElementAsync(document, tag_name,
GetCreateElementFlags());
} else {
element = document.createElement(tag_name, GetCreateElementFlags());
}
// Definition for the created element does not exist here and it cannot be
// custom or failed.
DCHECK_NE(element->GetCustomElementState(), CustomElementState::kCustom);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment