Skip to content

Commit

Permalink
Prevent double custom element reaction enqueuing via upgrades
Browse files Browse the repository at this point in the history
As already discussed in the spec (as of #1365), it is sometimes possible
to enqueue two upgrade reactions, via a constructor that does things you
are not supposed to do. The fix in #1365 prevented upgrading twice.
However, it did not bail out early enough, and allowed
attributeChangedCallback and connectedCallback reactions to be enqueued
(redundantly) before the bail-out. This commit moves the bail-out logic
to the beginning of the algorithm, so as to avoid any such
double-enqueuing.

Fixes WICG/webcomponents#523.
  • Loading branch information
domenic committed Jun 21, 2016
1 parent 6e17d01 commit ed27716
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -66669,16 +66669,6 @@ fetch(articleURL)
<var>element</var>, run the following steps:</p>

<ol>
<li><p>For each <var>attribute</var> in <var>element</var>'s <span>attribute list</span>, in
order, <span>enqueue a custom element callback reaction</span> with <var>element</var>, callback
name "<code data-x="">attributeChangedCallback</code>", and an argument list containing
<var>attribute</var>'s local name, null, <var>attribute</var>'s value, and <var>attribute</var>'s
namespace.</p></li>

<li><p>If <var>element</var> is currently <span>in a shadow-including document</span>, then
<span>enqueue a custom element callback reaction</span> with <var>element</var>, callback name
"<code data-x="">connectedCallback</code>", and an empty argument list.</p></li>

<li>
<p>If <var>element</var> is <span data-x="concept-element-custom">custom</span>, abort these
steps.</p>
Expand Down Expand Up @@ -66715,6 +66705,16 @@ customElements.define("x-foo", class extends HTMLElement {
</div>
</li>

<li><p>For each <var>attribute</var> in <var>element</var>'s <span>attribute list</span>, in
order, <span>enqueue a custom element callback reaction</span> with <var>element</var>, callback
name "<code data-x="">attributeChangedCallback</code>", and an argument list containing
<var>attribute</var>'s local name, null, <var>attribute</var>'s value, and <var>attribute</var>'s
namespace.</p></li>

<li><p>If <var>element</var> is currently <span>in a shadow-including document</span>, then
<span>enqueue a custom element callback reaction</span> with <var>element</var>, callback name
"<code data-x="">connectedCallback</code>", and an empty argument list.</p></li>

<li><p>Add <var>element</var> to the end of <var>definition</var>'s <span
data-x="concept-custom-element-definition-construction-stack">construction stack</span>.</p></li>

Expand Down

0 comments on commit ed27716

Please sign in to comment.