Skip to content

Commit

Permalink
Don't let a slot do anything special if it isn't in a shadow tree
Browse files Browse the repository at this point in the history
A slot's children are no longer considered as the slot's fallback contents if
the slot is not in a shadow tree.  Such a slot no longer signals a slot change
even if its children are updated.

This patch also removes a concept of suppress signaling flag for a slot change
entirely. A slot change is always signaled when a slot's assigned nodes are
changed.

Fixes whatwg#447.
  • Loading branch information
hayatoito committed Jun 2, 2017
1 parent b2f4292 commit 2bd8992
Showing 1 changed file with 17 additions and 23 deletions.
40 changes: 17 additions & 23 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,9 @@ for a given <a>slot</a> <var>slot</var>, run these steps:</p>
<ol>
<li><p>Let <var>result</var> be an empty list.</p></li>

<li><p>If <var>slot</var>'s <a for=tree>root</a> is not a <a for=/>shadow root</a>, then return
<var>result</var>.</p></li>

<li><p>Let <var>slotables</var> be the result of <a>finding slotables</a> given
<var>slot</var>.</p></li>

Expand Down Expand Up @@ -1738,32 +1741,23 @@ for a given <a>slot</a> <var>slot</var>, run these steps:</p>

<h5 id=assigning-slotables-and-slots>Assigning slotables and slots</h5>

<p>To <dfn noexport>assign slotables</dfn>, for a <a>slot</a> <var>slot</var> with an optional
<var>suppress signaling flag</var> (unset unless stated otherwise), run these steps:
<p>To <dfn noexport>assign slotables</dfn> for a <a>slot</a> <var>slot</var>, run these steps:

<ol>
<li><p>Let <var>slotables</var> be the result of <a>finding slotables</a> for <var>slot</var>.

<li><p>If <var>suppress signaling flag</var> is unset, and <var>slotables</var> and
<var>slot</var>'s <a for=slot>assigned nodes</a> are not identical, then run
<a>signal a slot change</a> for <var>slot</var>.
<li><p>If <var>slotables</var> and <var>slot</var>'s <a for=slot>assigned
nodes</a> are not identical, then run <a>signal a slot change</a> for <var>slot</var>.

<li><p>Set <var>slot</var>'s <a for=slot>assigned nodes</a> to <var>slotables</var>.

<li><p>For each <var>slotable</var> in <var>slotables</var>, set <var>slotable</var>'s
<a>assigned slot</a> to <var>slot</var>.
</ol>

<p>To <dfn noexport>assign slotables for a tree</dfn>, given a <a>tree</a> <var>tree</var> and an
optional set of <a>slots</a> <var>noSignalSlots</var> (empty unless stated otherwise), run these
steps for each <a>slot</a> <var>slot</var> in <var>tree</var>, in <a>tree order</a>:

<ol>
<li><p>Let <var>suppress signaling flag</var> be set, if <var>slot</var> is in
<var>noSignalSlots</var>, and unset otherwise.</p></li>

<li><p>Run <a>assign slotables</a> for <var>slot</var> with <var>suppress signaling flag</var>.
</ol>
<p>To <dfn noexport>assign slotables for a tree</dfn>, given a <a>tree</a>
<var>tree</var>, run <a>assign slotables</a> for each <a>slot</a> <var>slot</var> in
<var>tree</var>, in <a>tree order</a>.

<p>To <dfn noexport>assign a slot</dfn>, given a <a>slotable</a> <var>slotable</var>, run these
steps:
Expand Down Expand Up @@ -1961,11 +1955,11 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
<li><p>If <var>parent</var> is a <a for=Element>shadow host</a> and <var>node</var> is a
<a>slotable</a>, then <a>assign a slot</a> for <var>node</var>.

<li><p>If <var>parent</var> is a <a>slot</a> whose <a for=slot>assigned nodes</a> is the empty
list, then run <a>signal a slot change</a> for <var>parent</var>.
<li><p>If <var>parent</var>'s <a for=tree>root</a> is a <a for=/>shadow root</a>, and
<var>parent</var> is a <a>slot</a> whose <a for=slot>assigned nodes</a> is the empty list,
then run <a>signal a slot change</a> for <var>parent</var>.

<li><p>Run <a>assign slotables for a tree</a> with <var>node</var>'s <a>tree</a> and a set
containing each <a>inclusive descendant</a> of <var>node</var> that is a <a>slot</a>.
<li><p>Run <a>assign slotables for a tree</a> with <var>node</var>'s <a>tree</a>.

<li>
<p>For each <a>shadow-including inclusive descendant</a> <var>inclusiveDescendant</var> of
Expand Down Expand Up @@ -2232,16 +2226,16 @@ with an optional <i>suppress observers flag</i>, run these steps:
<li><p>If <var>node</var> is <a for=slotable>assigned</a>, then run <a>assign slotables</a> for
<var>node</var>'s <a>assigned slot</a>.

<li><p>If <var>parent</var> is a <a>slot</a> whose <a for=slot>assigned nodes</a> is the empty
list, then run <a>signal a slot change</a> for <var>parent</var>.
<li><p>If <var>parent</var>'s <a for=tree>root</a> is a <a for=/>shadow root</a>, and
<var>parent</var> is a <a>slot</a> whose <a for=slot>assigned nodes</a> is the empty list,
then run <a>signal a slot change</a> for <var>parent</var>.

<li><p>If <var>node</var> has an <a>inclusive descendant</a> that is a <a>slot</a>, then:

<ol>
<li><p>Run <a>assign slotables for a tree</a> with <var>parent</var>'s <a>tree</a>.

<li><p>Run <a>assign slotables for a tree</a> with <var>node</var>'s <a>tree</a> and a set
containing each <a>inclusive descendant</a> of <var>node</var> that is a <a>slot</a>.
<li><p>Run <a>assign slotables for a tree</a> with <var>node</var>'s <a>tree</a>.
</ol>

<li><p>Run the <a>removing steps</a> with <var>node</var> and <var>parent</var>.
Expand Down

0 comments on commit 2bd8992

Please sign in to comment.