Skip to content
Permalink
Browse files

[e] (0) Integrate with DOM for 'removing steps' and 'insertion steps'.

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=24653
Affected topics: DOM APIs, HTML, Video and Audio

git-svn-id: http://svn.whatwg.org/webapps@8769 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 12, 2014
1 parent da81046 commit 30eb58718a7581b6fe25c31bcee29c92d1262a00
Showing with 41 additions and 17 deletions.
  1. +14 −6 complete.html
  2. +14 −6 index
  3. +13 −5 source
string, means that the length of the text is zero (i.e. not even containing spaces or <a href=#control-characters id=dom-trees:control-characters>control
characters</a>).</p>

<p>A <dfn id=nodes-are-inserted>node <var>A</var> is inserted</dfn> into a node <var>B</var>
when the <a href=http://dom.spec.whatwg.org/#concept-node-insert-ext id=dom-trees:concept-node-insert-ext data-x-internal=concept-node-insert-ext>insertion steps</a> are invoked with
<var>A</var> as the argument and <var>A</var>'s new parent is <var>B</var>. Similarly, a <dfn id=nodes-are-removed>node <var>A</var> is removed</dfn> from a node <var>B</var> when the
<a href=http://dom.spec.whatwg.org/#concept-node-remove-ext id=dom-trees:concept-node-remove-ext data-x-internal=concept-node-remove-ext>removing steps</a> are invoked with <var>A</var> as the
<var>removedNode</var> argument and <var>B</var> as the <var>oldParent</var> argument.</p>


<h4 id=scripting-2>2.1.4 Scripting</h4>


<p>In particular, the following features are defined in the DOM specification: <a href=#refsDOM>[DOM]</a></p>

<ul class=brief><li><dfn id=attr><code>Attr</code></dfn> interface<li><dfn id=comment-2><code>Comment</code></dfn> interface<li><dfn id=domimplementation><code>DOMImplementation</code></dfn> interface<li><dfn id=dom-document><code>Document</code></dfn> interface<li><dfn id=xmldocument><code>XMLDocument</code></dfn> interface<li><dfn id=documentfragment><code>DocumentFragment</code></dfn> interface<li><dfn id=documenttype><code>DocumentType</code></dfn> interface<li><dfn id=domexception><code>DOMException</code></dfn> interface<li><dfn id=childnode><code>ChildNode</code></dfn> interface<li><dfn id=element><code>Element</code></dfn> interface<li><dfn id=node><code>Node</code></dfn> interface<li><dfn id=nodelist><code>NodeList</code></dfn> interface<li><dfn id=processinginstruction><code>ProcessingInstruction</code></dfn> interface<li><dfn id=text><code>Text</code></dfn> interface<li><dfn id=node-document><a href=http://dom.spec.whatwg.org/#concept-node-document>node document</a></dfn> concept<li><dfn id=htmlcollection><code>HTMLCollection</code></dfn> interface<li><dfn id=dom-htmlcollection-length><code>HTMLCollection.length</code></dfn> attribute<li><dfn id=dom-htmlcollection-item><code>HTMLCollection.item()</code></dfn> method<li><dfn id=dom-htmlcollection-nameditem><code>HTMLCollection.namedItem()</code></dfn> method<li>The terms <dfn id=collections>collections</dfn> and <dfn id=represented-by-the-collection>represented by the collection</dfn><li><dfn id=domtokenlist><code>DOMTokenList</code></dfn> interface<li><dfn id=domsettabletokenlist><code>DOMSettableTokenList</code></dfn> interface<li><dfn id=dom-domsettabletokenlist-value><code>DOMSettableTokenList.value</code></dfn> attribute<li><dfn id=dom-domimplementation-createdocument><code>createDocument()</code></dfn> method<li><dfn id=dom-domimplementation-createhtmldocument><code>createHTMLDocument()</code></dfn> method<li><dfn id=dom-document-createelement><code>createElement()</code></dfn> method<li><dfn id=dom-document-createelementns><code>createElementNS()</code></dfn> method<li><dfn id=dom-document-getelementbyid><code>getElementById()</code></dfn> method<li><dfn id=dom-document-getelementsbyclassname><code>getElementsByClassName()</code></dfn> method<li><dfn id=dom-node-insertbefore><code>insertBefore()</code></dfn> method<li><dfn id=dom-node-childnodes><code>childNodes</code></dfn> attribute<li><dfn id=dom-node-localname><code>localName</code></dfn> attribute<li><dfn id=dom-node-parentnode><code>parentNode</code></dfn> attribute<li><dfn id=dom-node-namespaceuri><code>namespaceURI</code></dfn> attribute<li><dfn id=dom-element-tagname><code>tagName</code></dfn> attribute<li><dfn id=dom-element-id><code>id</code></dfn> attribute<li><dfn id=textcontent><code>textContent</code></dfn> attribute<li>The <dfn id=concept-node-insert>insert</dfn>, <dfn id=concept-node-append>append</dfn>, <dfn id=concept-node-remove>remove</dfn>, <dfn id=concept-node-replace>replace</dfn>, and <dfn id=concept-node-adopt>adopt</dfn> algorithms for nodes<li>The <dfn id=nodes-are-inserted>nodes are inserted</dfn> and <dfn id=nodes-are-removed>nodes are removed</dfn> concepts<li>An element's <dfn id=concept-node-adopt-ext>adopting steps</dfn><li>The <dfn id=attribute-list>attribute list</dfn> concept.<li>The <dfn id=concept-cd-data>data</dfn> of a text node.<li><dfn id=event><code>Event</code></dfn> interface<li><dfn id=eventtarget><code>EventTarget</code></dfn> interface<li><dfn id=eventinit><code>EventInit</code></dfn> dictionary type<li><dfn id=dom-event-target><code>target</code></dfn> attribute<li><dfn id=dom-event-currenttarget><code>currentTarget</code></dfn> attribute<li><dfn id=dom-event-istrusted><code>isTrusted</code></dfn> attribute<li><dfn id=dom-event-initevent><code>initEvent()</code></dfn> method<li><dfn id=dom-eventtarget-addeventlistener><code>addEventListener()</code></dfn> method<li>The <dfn id=concept-event-type>type</dfn> of an event<li>The concept of an <dfn id=concept-event-listener>event listener</dfn> and the <a href=#concept-event-listener id=dependencies:concept-event-listener>event listeners</a> associated with an <code id=dependencies:eventtarget><a href=#eventtarget>EventTarget</a></code><li>The concept of a <dfn id=concept-event-target-override>target override</dfn><li>The concept of a regular <dfn id=event-parent>event parent</dfn> and a <dfn id=cross-boundary-event-parent>cross-boundary event parent</dfn><li>The <dfn id="document's-character-encoding">encoding</dfn> (herein the <i>character encoding</i>) and <dfn id=concept-document-content-type>content type</dfn> of a <code id=dependencies:document><a href=#document>Document</a></code><li>The distinction between <dfn id=xml-documents>XML documents</dfn> and <dfn id=html-documents>HTML documents</dfn><li>The terms <dfn id=quirks-mode>quirks mode</dfn>, <dfn id=limited-quirks-mode>limited-quirks mode</dfn>, and <dfn id=no-quirks-mode>no-quirks mode</dfn><li>The algorithm to <dfn id=concept-node-clone>clone</dfn> a <code id=dependencies:node><a href=#node>Node</a></code>, and the concept of <dfn id=concept-node-clone-ext>cloning steps</dfn> used by that algorithm<li>The concept of <dfn id=base-url-change-steps>base URL change steps</dfn> and the definition of what happens when an element is <dfn id=affected-by-a-base-url-change>affected by a base URL change</dfn><li>The concept of an element's <dfn id=concept-id>unique identifier (ID)</dfn><li>The concept of a DOM <dfn id=concept-range>range</dfn>, and the terms <dfn id=concept-range-start>start</dfn>, <dfn id=concept-range-end>end</dfn>, and <dfn id=concept-range-bp>boundary point</dfn> as applied to ranges.<li><dfn id=mutationobserver><code>MutationObserver</code></dfn> interface<li><dfn id=promise>Promise</dfn> interface<li>The <dfn id=concept-resolver>resolver</dfn> concept<li>The <dfn id=concept-resolver-fulfill>fulfill</dfn> and <dfn id=concept-resolver-reject>reject</dfn> algorithms</ul>
<ul class=brief><li><dfn id=attr><code>Attr</code></dfn> interface<li><dfn id=comment-2><code>Comment</code></dfn> interface<li><dfn id=domimplementation><code>DOMImplementation</code></dfn> interface<li><dfn id=dom-document><code>Document</code></dfn> interface<li><dfn id=xmldocument><code>XMLDocument</code></dfn> interface<li><dfn id=documentfragment><code>DocumentFragment</code></dfn> interface<li><dfn id=documenttype><code>DocumentType</code></dfn> interface<li><dfn id=domexception><code>DOMException</code></dfn> interface<li><dfn id=childnode><code>ChildNode</code></dfn> interface<li><dfn id=element><code>Element</code></dfn> interface<li><dfn id=node><code>Node</code></dfn> interface<li><dfn id=nodelist><code>NodeList</code></dfn> interface<li><dfn id=processinginstruction><code>ProcessingInstruction</code></dfn> interface<li><dfn id=text><code>Text</code></dfn> interface<li><dfn id=node-document><a href=http://dom.spec.whatwg.org/#concept-node-document>node document</a></dfn> concept<li><dfn id=htmlcollection><code>HTMLCollection</code></dfn> interface<li><dfn id=dom-htmlcollection-length><code>HTMLCollection.length</code></dfn> attribute<li><dfn id=dom-htmlcollection-item><code>HTMLCollection.item()</code></dfn> method<li><dfn id=dom-htmlcollection-nameditem><code>HTMLCollection.namedItem()</code></dfn> method<li>The terms <dfn id=collections>collections</dfn> and <dfn id=represented-by-the-collection>represented by the collection</dfn><li><dfn id=domtokenlist><code>DOMTokenList</code></dfn> interface<li><dfn id=domsettabletokenlist><code>DOMSettableTokenList</code></dfn> interface<li><dfn id=dom-domsettabletokenlist-value><code>DOMSettableTokenList.value</code></dfn> attribute<li><dfn id=dom-domimplementation-createdocument><code>createDocument()</code></dfn> method<li><dfn id=dom-domimplementation-createhtmldocument><code>createHTMLDocument()</code></dfn> method<li><dfn id=dom-document-createelement><code>createElement()</code></dfn> method<li><dfn id=dom-document-createelementns><code>createElementNS()</code></dfn> method<li><dfn id=dom-document-getelementbyid><code>getElementById()</code></dfn> method<li><dfn id=dom-document-getelementsbyclassname><code>getElementsByClassName()</code></dfn> method<li><dfn id=dom-node-insertbefore><code>insertBefore()</code></dfn> method<li><dfn id=dom-node-childnodes><code>childNodes</code></dfn> attribute<li><dfn id=dom-node-localname><code>localName</code></dfn> attribute<li><dfn id=dom-node-parentnode><code>parentNode</code></dfn> attribute<li><dfn id=dom-node-namespaceuri><code>namespaceURI</code></dfn> attribute<li><dfn id=dom-element-tagname><code>tagName</code></dfn> attribute<li><dfn id=dom-element-id><code>id</code></dfn> attribute<li><dfn id=textcontent><code>textContent</code></dfn> attribute<li>The <dfn id=concept-node-insert>insert</dfn>, <dfn id=concept-node-append>append</dfn>, <dfn id=concept-node-remove>remove</dfn>, <dfn id=concept-node-replace>replace</dfn>, and <dfn id=concept-node-adopt>adopt</dfn> algorithms for nodes<li>The <dfn id=concept-node-insert-ext><a href=http://dom.spec.whatwg.org/#concept-node-insert-ext>insertion steps</a></dfn>,
<dfn id=concept-node-remove-ext><a href=http://dom.spec.whatwg.org/#concept-node-remove-ext>removing steps</a></dfn>,
and <dfn id=concept-node-adopt-ext><a href=http://dom.spec.whatwg.org/#concept-node-adopt-ext>adopting steps</a></dfn> hooks<li>The <dfn id=attribute-list>attribute list</dfn> concept.<li>The <dfn id=concept-cd-data>data</dfn> of a text node.<li><dfn id=event><code>Event</code></dfn> interface<li><dfn id=eventtarget><code>EventTarget</code></dfn> interface<li><dfn id=eventinit><code>EventInit</code></dfn> dictionary type<li><dfn id=dom-event-target><code>target</code></dfn> attribute<li><dfn id=dom-event-currenttarget><code>currentTarget</code></dfn> attribute<li><dfn id=dom-event-istrusted><code>isTrusted</code></dfn> attribute<li><dfn id=dom-event-initevent><code>initEvent()</code></dfn> method<li><dfn id=dom-eventtarget-addeventlistener><code>addEventListener()</code></dfn> method<li>The <dfn id=concept-event-type>type</dfn> of an event<li>The concept of an <dfn id=concept-event-listener>event listener</dfn> and the <a href=#concept-event-listener id=dependencies:concept-event-listener>event listeners</a> associated with an <code id=dependencies:eventtarget><a href=#eventtarget>EventTarget</a></code><li>The concept of a <dfn id=concept-event-target-override>target override</dfn><li>The concept of a regular <dfn id=event-parent>event parent</dfn> and a <dfn id=cross-boundary-event-parent>cross-boundary event parent</dfn><li>The <dfn id="document's-character-encoding">encoding</dfn> (herein the <i>character encoding</i>) and <dfn id=concept-document-content-type>content type</dfn> of a <code id=dependencies:document><a href=#document>Document</a></code><li>The distinction between <dfn id=xml-documents>XML documents</dfn> and <dfn id=html-documents>HTML documents</dfn><li>The terms <dfn id=quirks-mode>quirks mode</dfn>, <dfn id=limited-quirks-mode>limited-quirks mode</dfn>, and <dfn id=no-quirks-mode>no-quirks mode</dfn><li>The algorithm to <dfn id=concept-node-clone>clone</dfn> a <code id=dependencies:node><a href=#node>Node</a></code>, and the concept of <dfn id=concept-node-clone-ext>cloning steps</dfn> used by that algorithm<li>The concept of <dfn id=base-url-change-steps>base URL change steps</dfn> and the definition of what happens when an element is <dfn id=affected-by-a-base-url-change>affected by a base URL change</dfn><li>The concept of an element's <dfn id=concept-id>unique identifier (ID)</dfn><li>The concept of a DOM <dfn id=concept-range>range</dfn>, and the terms <dfn id=concept-range-start>start</dfn>, <dfn id=concept-range-end>end</dfn>, and <dfn id=concept-range-bp>boundary point</dfn> as applied to ranges.<li><dfn id=mutationobserver><code>MutationObserver</code></dfn> interface<li><dfn id=promise>Promise</dfn> interface<li>The <dfn id=concept-resolver>resolver</dfn> concept<li>The <dfn id=concept-resolver-fulfill>fulfill</dfn> and <dfn id=concept-resolver-reject>reject</dfn> algorithms</ul>

<p>The term <dfn id=throw>throw</dfn> in this specification is used as defined in the DOM specification.
The following <code id=dependencies:domexception><a href=#domexception>DOMException</a></code> types are defined in the DOM specification: <a href=#refsDOM>[DOM]</a></p>
with the <i>restart animation</i> flag set if so stated,
whenever that element is created,
or has experienced <a href=#relevant-mutations id=the-img-element:relevant-mutations>relevant mutations</a>,
and whenever that element's <a href=#concept-node-adopt-ext id=the-img-element:concept-node-adopt-ext>adopting steps</a> are run.</p>
and whenever that element's <a href=http://dom.spec.whatwg.org/#concept-node-adopt-ext id=the-img-element:concept-node-adopt-ext data-x-internal=concept-node-adopt-ext>adopting steps</a> are run.</p>

<p>A user agent that obtains images on demand must <a href=#update-the-image-data id=the-img-element:update-the-image-data-2>update the image data</a> of an
<code id=the-img-element:the-img-element-11><a href=#the-img-element>img</a></code> element whenever it needs the image data (i.e. on demand),
but only if the <code id=the-img-element:the-img-element-12><a href=#the-img-element>img</a></code> element is in the
<a href=#img-none id=the-img-element:img-none-2>unavailable</a> state. When an <code id=the-img-element:the-img-element-13><a href=#the-img-element>img</a></code> element
has experienced <a href=#relevant-mutations id=the-img-element:relevant-mutations-2>relevant mutations</a>,
and whenever that element's <a href=#concept-node-adopt-ext id=the-img-element:concept-node-adopt-ext-2>adopting steps</a> are run, if the user
and whenever that element's <a href=http://dom.spec.whatwg.org/#concept-node-adopt-ext id=the-img-element:concept-node-adopt-ext-2 data-x-internal=concept-node-adopt-ext>adopting steps</a> are run, if the user
agent only obtains images on demand, the <code id=the-img-element:the-img-element-14><a href=#the-img-element>img</a></code> element must return to the <a href=#img-none id=the-img-element:img-none-3>unavailable</a> state.</p>

<p>The <dfn id=relevant-mutations>relevant mutations</dfn> for an <code id=the-img-element:the-img-element-15><a href=#the-img-element>img</a></code> element are as follows:</p>



<p>If a <code id=the-source-element:the-source-element-4><a href=#the-source-element>source</a></code> element is inserted as a child of a <a href=#media-element id=the-source-element:media-element-4>media element</a> that
<p>If a <code id=the-source-element:the-source-element-4><a href=#the-source-element>source</a></code> <a href=#nodes-are-inserted id=the-source-element:nodes-are-inserted>element is inserted</a> as a child of a <a href=#media-element id=the-source-element:media-element-4>media element</a> that
has no <code id=the-source-element:attr-media-src-2><a href=#attr-media-src>src</a></code> attribute and whose <code id=the-source-element:dom-media-networkstate><a href=#dom-media-networkstate>networkState</a></code> has the value <code id=the-source-element:dom-media-network_empty><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, the user agent must invoke the <a href=#media-element id=the-source-element:media-element-5>media
element</a>'s <a href=#concept-media-load-algorithm id=the-source-element:concept-media-load-algorithm>resource selection
algorithm</a>.</p>
other node is the node after <var>pointer</var>. Initially, let <var>pointer</var> be the position between the <var>candidate</var> node and the
next node, if there are any, or the end of the list, if it is the last node.</p>

<p>As nodes are inserted and removed into the <a href=#media-element id=loading-the-media-resource:media-element-22>media element</a>, <var>pointer</var> must be updated as follows:</p>
<p>As <a href=#nodes-are-inserted id=loading-the-media-resource:nodes-are-inserted>nodes are inserted</a> and <a href=#nodes-are-removed id=loading-the-media-resource:nodes-are-removed>removed</a> into the <a href=#media-element id=loading-the-media-resource:media-element-22>media element</a>, <var>pointer</var> must be updated as follows:</p>

<dl><dt>If a new node is inserted between the two nodes that define <var>pointer</var><dd>Let <var>pointer</var> be the point between the node before <var>pointer</var> and the new node. In other words, insertions at <var>pointer</var> go after <var>pointer</var>.<dt>If the node before <var>pointer</var> is removed<dd>Let <var>pointer</var> be the point between the node after <var>pointer</var> and the node before the node after <var>pointer</var>. In
<dl><dt>If a new <a href=#nodes-are-inserted id=loading-the-media-resource:nodes-are-inserted-2>node is inserted</a> between the two nodes that define <var>pointer</var><dd>Let <var>pointer</var> be the point between the node before <var>pointer</var> and the new node. In other words, insertions at <var>pointer</var> go after <var>pointer</var>.<dt>If the node before <var>pointer</var> is removed<dd>Let <var>pointer</var> be the point between the node after <var>pointer</var> and the node before the node after <var>pointer</var>. In
other words, <var>pointer</var> doesn't move relative to the remaining nodes.<dt>If the node after <var>pointer</var> is removed<dd>Let <var>pointer</var> be the point between the node before <var>pointer</var> and the node after the node before <var>pointer</var>. Just
as with the previous case, <var>pointer</var> doesn't move relative to the remaining
nodes.</dl>

0 comments on commit 30eb587

Please sign in to comment.
You can’t perform that action at this time.