[html5] r8270 - [giow] (1) Share the ownerDocument of template contents amongst the templates of [...]

whatwg at whatwg.org whatwg at whatwg.org
Tue Nov 12 13:36:53 PST 2013


Author: ianh
Date: 2013-11-12 13:36:52 -0800 (Tue, 12 Nov 2013)
New Revision: 8270

Modified:
   complete.html
   index
   source
Log:
[giow] (1) Share the ownerDocument of template contents amongst the templates of a document.
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=23795
Affected topics: DOM APIs, HTML

Modified: complete.html
===================================================================
--- complete.html	2013-11-12 21:10:10 UTC (rev 8269)
+++ complete.html	2013-11-12 21:36:52 UTC (rev 8270)
@@ -3702,7 +3702,7 @@
      <li><dfn id=dom-element-id title=dom-Element-id><code>id</code></dfn> attribute</li>
      <li><dfn id=textcontent><code>textContent</code></dfn> attribute</li>
 
-     <li>The <dfn id=concept-node-insert title=concept-node-insert>insert</dfn>, <dfn id=concept-node-append title=concept-node-append>append</dfn>, <dfn id=concept-node-remove title=concept-node-remove>remove</dfn>, and <dfn id=concept-node-replace title=concept-node-replace>replace</dfn> algorithms for nodes</li>
+     <li>The <dfn id=concept-node-insert title=concept-node-insert>insert</dfn>, <dfn id=concept-node-append title=concept-node-append>append</dfn>, <dfn id=concept-node-remove title=concept-node-remove>remove</dfn>, <dfn id=concept-node-replace title=concept-node-replace>replace</dfn>, and <dfn id=concept-node-adopt title=concept-node-adopt>adopt</dfn> algorithms for nodes</li>
      <li>The <dfn id=nodes-are-inserted>nodes are inserted</dfn> and <dfn id=nodes-are-removed>nodes are removed</dfn> concepts</li>
      <li>The <dfn id=attribute-list>attribute list</dfn> concept.</li>
      <li>The <dfn id=concept-cd-data title=concept-cd-data>data</dfn> of a text node.</li>
@@ -52559,28 +52559,58 @@
   is its <dfn id=template-contents>template contents</dfn>. When a <code><a href=#the-template-element>template</a></code> element is created, the user
   agent must run the following steps to establish the <a href=#template-contents>template contents</a>:</p>
 
-  <ol><li><p>Let <var title="">doc</var> be the <code><a href=#the-template-element>template</a></code> element's <code title=dom-node-ownerdocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>.</li>
+  <ol><li><p>Let <var title="">doc</var> be the <code><a href=#the-template-element>template</a></code> element's <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>'s <a href=#appropriate-template-contents-owner-document>appropriate template contents owner
+   document</a>.</li>
 
-   <li>
+   <li><p>Create a <code><a href=#documentfragment>DocumentFragment</a></code> object whose <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> is <var title="">doc</var>.</li>
 
+   <li><p>Set the <code><a href=#the-template-element>template</a></code> element's <a href=#template-contents>template contents</a> to the newly
+   created <code><a href=#documentfragment>DocumentFragment</a></code> object.</li>
+
+  </ol><p>A <code><a href=#document>Document</a></code> <var title="">doc</var>'s <dfn id=appropriate-template-contents-owner-document>appropriate template contents owner
+  document</dfn> is the <code><a href=#document>Document</a></code> returned by the following algorithm:</p>
+
+  <ol><li>
+
     <p>If <var title="">doc</var> has an associated <a href=#browsing-context>browsing context</a>, run these substeps:</p>
 
-    <ol><li><p>Let <var title="">new doc</var> be a new <code><a href=#document>Document</a></code> (that does not have a
-     <a href=#browsing-context>browsing context</a>).</li>
+    <ol><li>
 
-     <li><p>If <var title="">doc</var> is an <a href=#html-documents title="HTML documents">HTML document</a>, mark
-     <var title="">new doc</var> as an <a href=#html-documents title="HTML documents">HTML document</a>
-     also.</li>
+      <p>If <var title="">doc</var> does not yet have an <dfn id=associated-inert-template-document>associated inert template
+      document</dfn> then run these substeps:</p>
 
-     <li><p>Set <var title="">doc</var> to <var title="">new doc</var>.</li>
+      <ol><li><p>Let <var title="">new doc</var> be a new <code><a href=#document>Document</a></code> (that does not have a
+       <a href=#browsing-context>browsing context</a>).</li>
 
-    </ol></li>
+       <li><p>If <var title="">doc</var> is an <a href=#html-documents title="HTML documents">HTML document</a>, mark
+       <var title="">new doc</var> as an <a href=#html-documents title="HTML documents">HTML document</a>
+       also.</li>
 
-   <li><p>Create a <code><a href=#documentfragment>DocumentFragment</a></code> object whose <code title=dom-node-ownerdocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> is <var title="">doc</var>.</li>
+       <li><p>Let <var title="">doc</var>'s <a href=#associated-inert-template-document>associated inert template document</a> be <var title="">new doc</var>.</li>
 
-   <li><p>Set the <code><a href=#the-template-element>template</a></code> element's <a href=#template-contents>template contents</a> to the newly
-   created <code><a href=#documentfragment>DocumentFragment</a></code> object.</li>
+      </ol></li>
 
+     <li><p>Set <var title="">doc</var> to <var title="">doc</var>'s <a href=#associated-inert-template-document>associated inert
+     template document</a>.</li>
+
+    </ol><p class=note>Each <code><a href=#document>Document</a></code> associated with a <a href=#browsing-context>browsing context</a> thus
+    gets a single <code><a href=#document>Document</a></code> to act as its proxy for owning the <a href=#template-contents>template
+    contents</a> of all its <code><a href=#the-template-element>template</a></code> elements, so that they aren't in a
+    <a href=#browsing-context>browsing context</a> and thus remain inert (e.g. scripts do not run).</p>
+
+   </li>
+
+   <li><p>Return <var title="">doc</var>.</li>
+
+  </ol><p>When a <code><a href=#the-template-element>template</a></code> element changes <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>, the user agent must run the following
+  steps:</p>
+
+  <ol><li><p>Let <var title="">doc</var> be the <code><a href=#the-template-element>template</a></code> element's new <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>'s <a href=#appropriate-template-contents-owner-document>appropriate template contents owner
+   document</a>.</li>
+
+   <li><p><a href=#concept-node-adopt title=concept-node-adopt>Adopt</a> the <code><a href=#the-template-element>template</a></code> element's
+   <a href=#template-contents>template contents</a> (a <code><a href=#documentfragment>DocumentFragment</a></code> object) into <var title="">doc</var>.</li>
+
   </ol><p>The <dfn id=dom-template-content title=dom-template-content><code>content</code></dfn> IDL attribute must return the
   <code><a href=#the-template-element>template</a></code> element's <a href=#template-contents>template contents</a>.</p>
 
@@ -52591,7 +52621,7 @@
   <ol><li><p>If the <var title="">clone children flag</var> is not set in the calling <a href=#concept-node-clone title=concept-node-clone>clone</a> algorithm, abort these steps.</li>
 
    <li><p>Let <var title="">copied contents</var> be the result of <a href=#concept-node-clone title=concept-node-clone>cloning</a> all the children of <var title="">node</var>'s
-   <a href=#template-contents>template contents</a>, with <var title="">ownerDocument</var> set to <var title="">copy</var>'s <a href=#template-contents>template contents</a>'s <code title=dom-node-ownerdocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>, and with the <var title="">clone children
+   <a href=#template-contents>template contents</a>, with <var title="">ownerDocument</var> set to <var title="">copy</var>'s <a href=#template-contents>template contents</a>'s <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>, and with the <var title="">clone children
    flag</var> set.</li>
 
    <li><p>Append <var title="">copied contents</var> to <var title="">copy</var>'s <a href=#template-contents>template

Modified: index
===================================================================
--- index	2013-11-12 21:10:10 UTC (rev 8269)
+++ index	2013-11-12 21:36:52 UTC (rev 8270)
@@ -3702,7 +3702,7 @@
      <li><dfn id=dom-element-id title=dom-Element-id><code>id</code></dfn> attribute</li>
      <li><dfn id=textcontent><code>textContent</code></dfn> attribute</li>
 
-     <li>The <dfn id=concept-node-insert title=concept-node-insert>insert</dfn>, <dfn id=concept-node-append title=concept-node-append>append</dfn>, <dfn id=concept-node-remove title=concept-node-remove>remove</dfn>, and <dfn id=concept-node-replace title=concept-node-replace>replace</dfn> algorithms for nodes</li>
+     <li>The <dfn id=concept-node-insert title=concept-node-insert>insert</dfn>, <dfn id=concept-node-append title=concept-node-append>append</dfn>, <dfn id=concept-node-remove title=concept-node-remove>remove</dfn>, <dfn id=concept-node-replace title=concept-node-replace>replace</dfn>, and <dfn id=concept-node-adopt title=concept-node-adopt>adopt</dfn> algorithms for nodes</li>
      <li>The <dfn id=nodes-are-inserted>nodes are inserted</dfn> and <dfn id=nodes-are-removed>nodes are removed</dfn> concepts</li>
      <li>The <dfn id=attribute-list>attribute list</dfn> concept.</li>
      <li>The <dfn id=concept-cd-data title=concept-cd-data>data</dfn> of a text node.</li>
@@ -52559,28 +52559,58 @@
   is its <dfn id=template-contents>template contents</dfn>. When a <code><a href=#the-template-element>template</a></code> element is created, the user
   agent must run the following steps to establish the <a href=#template-contents>template contents</a>:</p>
 
-  <ol><li><p>Let <var title="">doc</var> be the <code><a href=#the-template-element>template</a></code> element's <code title=dom-node-ownerdocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>.</li>
+  <ol><li><p>Let <var title="">doc</var> be the <code><a href=#the-template-element>template</a></code> element's <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>'s <a href=#appropriate-template-contents-owner-document>appropriate template contents owner
+   document</a>.</li>
 
-   <li>
+   <li><p>Create a <code><a href=#documentfragment>DocumentFragment</a></code> object whose <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> is <var title="">doc</var>.</li>
 
+   <li><p>Set the <code><a href=#the-template-element>template</a></code> element's <a href=#template-contents>template contents</a> to the newly
+   created <code><a href=#documentfragment>DocumentFragment</a></code> object.</li>
+
+  </ol><p>A <code><a href=#document>Document</a></code> <var title="">doc</var>'s <dfn id=appropriate-template-contents-owner-document>appropriate template contents owner
+  document</dfn> is the <code><a href=#document>Document</a></code> returned by the following algorithm:</p>
+
+  <ol><li>
+
     <p>If <var title="">doc</var> has an associated <a href=#browsing-context>browsing context</a>, run these substeps:</p>
 
-    <ol><li><p>Let <var title="">new doc</var> be a new <code><a href=#document>Document</a></code> (that does not have a
-     <a href=#browsing-context>browsing context</a>).</li>
+    <ol><li>
 
-     <li><p>If <var title="">doc</var> is an <a href=#html-documents title="HTML documents">HTML document</a>, mark
-     <var title="">new doc</var> as an <a href=#html-documents title="HTML documents">HTML document</a>
-     also.</li>
+      <p>If <var title="">doc</var> does not yet have an <dfn id=associated-inert-template-document>associated inert template
+      document</dfn> then run these substeps:</p>
 
-     <li><p>Set <var title="">doc</var> to <var title="">new doc</var>.</li>
+      <ol><li><p>Let <var title="">new doc</var> be a new <code><a href=#document>Document</a></code> (that does not have a
+       <a href=#browsing-context>browsing context</a>).</li>
 
-    </ol></li>
+       <li><p>If <var title="">doc</var> is an <a href=#html-documents title="HTML documents">HTML document</a>, mark
+       <var title="">new doc</var> as an <a href=#html-documents title="HTML documents">HTML document</a>
+       also.</li>
 
-   <li><p>Create a <code><a href=#documentfragment>DocumentFragment</a></code> object whose <code title=dom-node-ownerdocument><a href=#dom-node-ownerdocument>ownerDocument</a></code> is <var title="">doc</var>.</li>
+       <li><p>Let <var title="">doc</var>'s <a href=#associated-inert-template-document>associated inert template document</a> be <var title="">new doc</var>.</li>
 
-   <li><p>Set the <code><a href=#the-template-element>template</a></code> element's <a href=#template-contents>template contents</a> to the newly
-   created <code><a href=#documentfragment>DocumentFragment</a></code> object.</li>
+      </ol></li>
 
+     <li><p>Set <var title="">doc</var> to <var title="">doc</var>'s <a href=#associated-inert-template-document>associated inert
+     template document</a>.</li>
+
+    </ol><p class=note>Each <code><a href=#document>Document</a></code> associated with a <a href=#browsing-context>browsing context</a> thus
+    gets a single <code><a href=#document>Document</a></code> to act as its proxy for owning the <a href=#template-contents>template
+    contents</a> of all its <code><a href=#the-template-element>template</a></code> elements, so that they aren't in a
+    <a href=#browsing-context>browsing context</a> and thus remain inert (e.g. scripts do not run).</p>
+
+   </li>
+
+   <li><p>Return <var title="">doc</var>.</li>
+
+  </ol><p>When a <code><a href=#the-template-element>template</a></code> element changes <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>, the user agent must run the following
+  steps:</p>
+
+  <ol><li><p>Let <var title="">doc</var> be the <code><a href=#the-template-element>template</a></code> element's new <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>'s <a href=#appropriate-template-contents-owner-document>appropriate template contents owner
+   document</a>.</li>
+
+   <li><p><a href=#concept-node-adopt title=concept-node-adopt>Adopt</a> the <code><a href=#the-template-element>template</a></code> element's
+   <a href=#template-contents>template contents</a> (a <code><a href=#documentfragment>DocumentFragment</a></code> object) into <var title="">doc</var>.</li>
+
   </ol><p>The <dfn id=dom-template-content title=dom-template-content><code>content</code></dfn> IDL attribute must return the
   <code><a href=#the-template-element>template</a></code> element's <a href=#template-contents>template contents</a>.</p>
 
@@ -52591,7 +52621,7 @@
   <ol><li><p>If the <var title="">clone children flag</var> is not set in the calling <a href=#concept-node-clone title=concept-node-clone>clone</a> algorithm, abort these steps.</li>
 
    <li><p>Let <var title="">copied contents</var> be the result of <a href=#concept-node-clone title=concept-node-clone>cloning</a> all the children of <var title="">node</var>'s
-   <a href=#template-contents>template contents</a>, with <var title="">ownerDocument</var> set to <var title="">copy</var>'s <a href=#template-contents>template contents</a>'s <code title=dom-node-ownerdocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>, and with the <var title="">clone children
+   <a href=#template-contents>template contents</a>, with <var title="">ownerDocument</var> set to <var title="">copy</var>'s <a href=#template-contents>template contents</a>'s <code title=dom-Node-ownerDocument><a href=#dom-node-ownerdocument>ownerDocument</a></code>, and with the <var title="">clone children
    flag</var> set.</li>
 
    <li><p>Append <var title="">copied contents</var> to <var title="">copy</var>'s <a href=#template-contents>template

Modified: source
===================================================================
--- source	2013-11-12 21:10:10 UTC (rev 8269)
+++ source	2013-11-12 21:36:52 UTC (rev 8270)
@@ -2450,7 +2450,7 @@
      <li><dfn data-x="dom-Element-id"><code>id</code></dfn> attribute</li>
      <li><dfn><code>textContent</code></dfn> attribute</li>
 
-     <li>The <dfn data-x="concept-node-insert">insert</dfn>, <dfn data-x="concept-node-append">append</dfn>, <dfn data-x="concept-node-remove">remove</dfn>, and <dfn data-x="concept-node-replace">replace</dfn> algorithms for nodes</li>
+     <li>The <dfn data-x="concept-node-insert">insert</dfn>, <dfn data-x="concept-node-append">append</dfn>, <dfn data-x="concept-node-remove">remove</dfn>, <dfn data-x="concept-node-replace">replace</dfn>, and <dfn data-x="concept-node-adopt">adopt</dfn> algorithms for nodes</li>
      <li>The <dfn>nodes are inserted</dfn> and <dfn>nodes are removed</dfn> concepts</li>
      <li>The <dfn>attribute list</dfn> concept.</li>
      <li>The <dfn data-x="concept-cd-data">data</dfn> of a text node.</li>
@@ -58060,33 +58060,79 @@
   <ol>
 
    <li><p>Let <var data-x="">doc</var> be the <code>template</code> element's <code
-   data-x="dom-node-ownerdocument">ownerDocument</code>.</p></li>
+   data-x="dom-Node-ownerDocument">ownerDocument</code>'s <span>appropriate template contents owner
+   document</span>.</p></li>
 
+   <li><p>Create a <code>DocumentFragment</code> object whose <code
+   data-x="dom-Node-ownerDocument">ownerDocument</code> is <var data-x="">doc</var>.</p></li>
+
+   <li><p>Set the <code>template</code> element's <span>template contents</span> to the newly
+   created <code>DocumentFragment</code> object.</p></li>
+
+  </ol>
+
+  <p>A <code>Document</code> <var data-x="">doc</var>'s <dfn>appropriate template contents owner
+  document</dfn> is the <code>Document</code> returned by the following algorithm:</p>
+
+  <ol>
+
    <li>
 
     <p>If <var data-x="">doc</var> has an associated <span>browsing context</span>, run these substeps:</p>
 
     <ol>
 
-     <li><p>Let <var data-x="">new doc</var> be a new <code>Document</code> (that does not have a
-     <span>browsing context</span>).</p></li>
+     <li>
 
-     <li><p>If <var data-x="">doc</var> is an <span data-x="HTML documents">HTML document</span>, mark
-     <var data-x="">new doc</var> as an <span data-x="HTML documents">HTML document</span>
-     also.</p></li>
+      <p>If <var data-x="">doc</var> does not yet have an <dfn>associated inert template
+      document</dfn> then run these substeps:</p>
 
-     <li><p>Set <var data-x="">doc</var> to <var data-x="">new doc</var>.</p></li>
+      <ol>
 
+       <li><p>Let <var data-x="">new doc</var> be a new <code>Document</code> (that does not have a
+       <span>browsing context</span>).</p></li>
+
+       <li><p>If <var data-x="">doc</var> is an <span data-x="HTML documents">HTML document</span>, mark
+       <var data-x="">new doc</var> as an <span data-x="HTML documents">HTML document</span>
+       also.</p></li>
+
+       <li><p>Let <var data-x="">doc</var>'s <span>associated inert template document</span> be <var
+       data-x="">new doc</var>.</p></li>
+
+      </ol>
+
+     </li>
+
+     <li><p>Set <var data-x="">doc</var> to <var data-x="">doc</var>'s <span>associated inert
+     template document</span>.</p></li>
+
     </ol>
 
+    <p class="note">Each <code>Document</code> associated with a <span>browsing context</span> thus
+    gets a single <code>Document</code> to act as its proxy for owning the <span>template
+    contents</span> of all its <code>template</code> elements, so that they aren't in a
+    <span>browsing context</span> and thus remain inert (e.g. scripts do not run).</p>
+
    </li>
 
-   <li><p>Create a <code>DocumentFragment</code> object whose <code
-   data-x="dom-node-ownerdocument">ownerDocument</code> is <var data-x="">doc</var>.</p></li>
+   <li><p>Return <var data-x="">doc</var>.</p></li>
 
-   <li><p>Set the <code>template</code> element's <span>template contents</span> to the newly
-   created <code>DocumentFragment</code> object.</p></li>
+  </ol>
 
+  <p>When a <code>template</code> element changes <code
+  data-x="dom-Node-ownerDocument">ownerDocument</code>, the user agent must run the following
+  steps:</p>
+
+  <ol>
+
+   <li><p>Let <var data-x="">doc</var> be the <code>template</code> element's new <code
+   data-x="dom-Node-ownerDocument">ownerDocument</code>'s <span>appropriate template contents owner
+   document</span>.</p></li>
+
+   <li><p><span data-x="concept-node-adopt">Adopt</span> the <code>template</code> element's
+   <span>template contents</span> (a <code>DocumentFragment</code> object) into <var
+   data-x="">doc</var>.</p></li>
+
   </ol>
 
   <p>The <dfn data-x="dom-template-content"><code>content</code></dfn> IDL attribute must return the
@@ -58107,7 +58153,7 @@
    data-x="concept-node-clone">cloning</span> all the children of <var data-x="">node</var>'s
    <span>template contents</span>, with <var data-x="">ownerDocument</var> set to <var
    data-x="">copy</var>'s <span>template contents</span>'s <code
-   data-x="dom-node-ownerdocument">ownerDocument</code>, and with the <var data-x="">clone children
+   data-x="dom-Node-ownerDocument">ownerDocument</code>, and with the <var data-x="">clone children
    flag</var> set.</p></li>
 
    <li><p>Append <var data-x="">copied contents</var> to <var data-x="">copy</var>'s <span>template




More information about the Commit-Watchers mailing list