Skip to content

Commit

Permalink
Set the stage for preventing double custom element constructor calls
Browse files Browse the repository at this point in the history
This is part of WICG/webcomponents#533. It introduces a new custom element state of "failed", which HTML will use on failed upgrades or failed parser-initiated element creation, to ensure that if a constructor fails, the element will not be upgraded in the future (i.e. the constructor will not be called again for that element).

(This also fixes a typo introduced when the DOM Standard got converted to use bikeshed.)
  • Loading branch information
domenic authored and annevk committed Jul 18, 2016
1 parent 970d750 commit 539e452
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 106 deletions.
19 changes: 12 additions & 7 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5596,18 +5596,21 @@ dictionary ShadowRootInit {
initialized.

<p>An <a for=/>element</a>'s <a>custom element state</a> is one of "<code>undefined</code>",
"<code>uncustomized</code>", or "<code>custom</code>". An <a for=/>element</a> whose
<a>custom element state</a> is "<code>uncustomized</code>" or "<code>custom</code>" is said to be
"<code>failed</code>", "<code>uncustomized</code>", or "<code>custom</code>". An
<a for=/>element</a> whose <a>custom element state</a> is "<code>uncustomized</code>" or
"<code>custom</code>" is said to be
<dfn export id=concept-element-defined for=Element>defined</dfn>. An <a for=/>element</a> whose
<a>custom element state</a> is "<code>custom</code>", is said to be
<a>custom element state</a> is "<code>custom</code>" is said to be
<dfn export id=concept-element-custom for=Element>custom</dfn>.

<p class=note>Whether or not an element is <a>defined</a> is used to determine the behavior of the
'':defined'' pseudo-class. Whether or not an element is <a>custom</a> is used to determine the
behavior of the <a href=#mutation-algorithms>mutation algorithms</a>.</p>
behavior of the <a href=#mutation-algorithms>mutation algorithms</a>. The "<code>failed</code>"
state is used to ensure that if a <a>custom element constructor</a> fails to execute correctly the
first time, it is not executed again by an <a lt="upgrade an element">upgrade</a>.</p>

<div class=example>
<p>The following code illustrates elements in each of these three states:</p>
<p>The following code illustrates elements in each of these four states:</p>

<pre><code class="lang-html">
&lt;!DOCTYPE html>
Expand All @@ -5623,10 +5626,12 @@ behavior of the <a href=#mutation-algorithms>mutation algorithms</a>.</p>

&lt;!-- "undefined" (not defined, not custom) -->
&lt;sw-han>&lt;/sw-han>
&lt;sw-kylo>&lt;/sw-kylo>
&lt;p is="sw-luke">&lt;/p>
&lt;p is="asdf">&lt;/p>

&lt;!-- "failed" (not defined, not custom) -->
&lt;sw-kylo>&lt;/sw-kylo>

&lt;!-- "uncustomized" (defined, not custom) -->
&lt;p>&lt;/p>
&lt;asdf>&lt;/asdf>
Expand Down Expand Up @@ -7135,7 +7140,7 @@ for selecting and copying content.
<ul class="domTree">
<li class="t1">{{Element}}: <code>p</code>
<ul>
<li class="t1">{{Element}}: <code class='lang-markup'>&lt;img src="insanity-wolf" alt="Little-ending BOM; decode as big-endian!"></code>
<li class="t1">{{Element}}: <code class='lang-markup'>&lt;img src="insanity-wolf" alt="Little-endian BOM; decode as big-endian!"></code>
<li class="t3">{{Text}}: <span>&nbsp;CSS 2.1 syndata is&nbsp;</span>
<li class="t1">{{Element}}: <code class='lang-markup'>&lt;em></code>
<ul>
Expand Down
Loading

0 comments on commit 539e452

Please sign in to comment.