[html5] r2039 - [e] (0) Prepare the ground for insertAdjacentHTML().

whatwg at whatwg.org whatwg at whatwg.org
Sun Aug 10 17:25:15 PDT 2008


Author: ianh
Date: 2008-08-10 17:25:14 -0700 (Sun, 10 Aug 2008)
New Revision: 2039

Modified:
   index
   source
Log:
[e] (0) Prepare the ground for insertAdjacentHTML().

Modified: index
===================================================================
--- index	2008-08-11 00:07:08 UTC (rev 2038)
+++ index	2008-08-11 00:25:14 UTC (rev 2039)
@@ -28,7 +28,7 @@
 
    <h1 id=html-5>HTML 5</h1>
 
-   <h2 class="no-num no-toc" id=draft>Draft Recommendation — 10 August
+   <h2 class="no-num no-toc" id=draft>Draft Recommendation — 11 August
     2008</h2>
 
    <p>You can take part in this work. <a
@@ -7634,6 +7634,7 @@
   // <a href="#dynamic3">dynamic markup insertion</a>
            attribute DOMString <a href="#innerhtml" title=dom-innerHTML>innerHTML</a>;
            attribute DOMString <a href="#outerhtml" title=dom-outerHTML>outerHTML</a>;
+  void <a href="#insertadjacenthtml" title=dom-insertAdjacentHTML>insertAdjacentHTML</a>(in DOMString position, in DOMString data);
 
   // <span>metadata attributes</span>
            attribute DOMString <a href="#id0" title=dom-id>id</a>;
@@ -8700,19 +8701,13 @@
   <h3 id=dynamic0><span class=secno>3.7 </span><dfn id=dynamic3>Dynamic
    markup insertion</dfn></h3>
 
-  <p>The <code title=dom-document-write><a
-   href="#document.write">document.write()</a></code> family of methods and
-   the <code title=dom-innerHTML><a
-   href="#innerhtml">innerHTML</a></code>/<code title=dom-outerHTML><a
-   href="#outerhtml">outerHTML</a></code> family of DOM attributes enable
-   script authors to dynamically insert markup into the document.
+  <p>APIs for dynamically inserting markup into the document interact with
+   the parser, and thus their behavior varies depending on whether they are
+   used with <a href="#html-">HTML documents</a> (and the <a
+   href="#html-0">HTML parser</a>) or XHTML in <a href="#xml-documents">XML
+   documents</a> (and the <span>XML parser</span>). The following table
+   cross-references the various versions of these APIs.
 
-  <p>Because these APIs interact with the parser, their behavior varies
-   depending on whether they are used with <a href="#html-">HTML
-   documents</a> (and the <a href="#html-0">HTML parser</a>) or XHTML in <a
-   href="#xml-documents">XML documents</a> (and the <span>XML parser</span>).
-   The following table cross-references the various versions of these APIs.
-
   <table>
    <thead>
     <tr>
@@ -8755,6 +8750,17 @@
       title=dom-outerHTML-HTML><code>outerHTML</code> in HTML</a>
 
      <td><a href="#outerhtml1" title=dom-outerHTML-XML>not supported</a>
+
+    <tr>
+     <th><dfn id=insertadjacenthtml
+      title=dom-insertAdjacentHTML><code>insertAdjacentHTML()</code></dfn>
+
+     <td><a href="#insertadjacenthtml0"
+      title=dom-insertAdjacentHTML-HTML><code>insertAdjacentHTML()</code> in
+      HTML</a>
+
+     <td><a href="#insertadjacenthtml1" title=dom-insertAdjacentHTML-XML>not
+      supported</a>
   </table>
 
   <p>Regardless of the parsing mode, the <dfn id=document.writeln...
@@ -8767,8 +8773,10 @@
   <p class=note>The <code title=dom-innerHTML><a
    href="#innerhtml">innerHTML</a></code> attribute applies to both
    <code>Element</code> nodes as well as <code>Document</code> nodes. The
-   <code title=dom-outerHTML><a href="#outerhtml">outerHTML</a></code>
-   attribute, on the other hand, only applies to <code>Element</code> nodes.
+   <code title=dom-outerHTML><a href="#outerhtml">outerHTML</a></code> and
+   <code title=dom-insertAdjacentHTML><a
+   href="#insertadjacenthtml">insertAdjacentHTML</a></code> attributes, on
+   the other hand, only apply to <code>Element</code> nodes.
 
   <p class=note>When inserted using the <code title=dom-document-write><a
    href="#document.write">document.write()</a></code> method, <code><a
@@ -9112,7 +9120,12 @@
      its place all the <var title="">new children</var> nodes, preserving
      their order.</p>
   </ol>
-  <!-- XXX must make sure we spec that innerHTML causes mutation
+
+  <hr>
+
+  <p class=big-issue><dfn id=insertadjacenthtml0
+   title=dom-insertAdjacentHTML-HTML><code>insertAdjacentHTML()</code></dfn></p>
+  <!-- XXX must make sure we spec that innerHTML et al causes mutation
   events to fire, but document.write() doesn't. (the latter is already
   req-stated in the parser section, btw) -->
   <!-- http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/innerhtml.asp -->
@@ -9257,8 +9270,10 @@
   <hr>
 
   <p>In an XML context, the <dfn id=document.write0
-   title=dom-document-write-XML><code>document.write()</code></dfn> method,
-   and the <dfn id=outerhtml1
+   title=dom-document-write-XML><code>document.write()</code></dfn> and <dfn
+   id=insertadjacenthtml1
+   title=dom-insertAdjacentHTML-XML><code>insertAdjacentHTML()</code></dfn>
+   methods, and the <dfn id=outerhtml1
    title=dom-outerHTML-XML><code>outerHTML</code></dfn> attribute on both
    getting and setting, must raise an <code>INVALID_ACCESS_ERR</code>
    exception.</p>
@@ -26202,8 +26217,8 @@
      parser</span> that itself was created as part of the processing of the
      <code title=dom-innerHTML-XML><a href="#innerhtml1">innerHTML</a></code>
      attribute's setter<!--
-    no need to worry about the innerHTML-HTML case, as the HTML parser
-    handles that for us, and outerHTML-XML doesn't work-->,
+    no need to worry about the HTML case, as the HTML parser handles
+    that for us -->,
      or if the user agent does not <a href="#support">support the scripting
      language</a> given by <var><a href="#the-scripts">the script's
      type</a></var> for this <code><a href="#script1">script</a></code>
@@ -45941,9 +45956,10 @@
    something other than a <link> or a <style> element; you'd expect
    that to break out of the <noscript> but it doesn't. This is an edge
    case that doesn't affect the spec, since the algorithm for fragment
-   parsing is only used for innerHTML/outerHTML, where we know
-   scripting is enabled. (XXX except maybe if innerHTML is set from
-   another browsing context on a document with designMode set?) -->
+   parsing is only used for innerHTML/outerHTML/insertAdjacentHTML(),
+   where we know scripting is enabled. (XXX except maybe if innerHTML
+   is set from another browsing context on a document with designMode
+   set?) -->
 
    <li>If <var title="">node</var> is a <code><a
     href="#body0">body</a></code> element, then switch the <span>insertion
@@ -48125,11 +48141,8 @@
    content inserted using <code title=dom-document-write-HTML><a
    href="#document.write...">document.write()</a></code> and <code
    title=dom-document-writeln><a
-   href="#document.writeln...">document.writeln()</a></code> calls.<!--
-  XXX xref -->
-   <a href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
-  <!-- XXX
-  what about innerHTML? -->
+   href="#document.writeln...">document.writeln()</a></code> calls. <a
+   href="#refsDOM3EVENTS">[DOM3EVENTS]</a>
 
   <p class=note>Not all of the tag names mentioned below are conformant tag
    names in this specification; many are included to handle legacy content.
@@ -49093,10 +49106,12 @@
      element as "already executed" prevents it from executing when it is
      inserted into the document a few paragraphs below. Thus, scripts missing
      their end tags and scripts that were inserted using <code
-     title=dom-innerHTML-HTML><a
-     href="#innerhtml0">innerHTML</a></code>/<code
-     title=dom-outerHTML-HTML><a href="#outerhtml0">outerHTML</a></code>
-     aren't executed.</p>
+     title=dom-innerHTML-HTML><a href="#innerhtml0">innerHTML</a></code>,
+     <code title=dom-outerHTML-HTML><a
+     href="#outerhtml0">outerHTML</a></code>, or <code
+     title=dom-insertAdjacentHTML-HTML><a
+     href="#insertadjacenthtml0">insertAdjacentHTML()</a></code> aren't
+     executed.</p>
 
     <p>Let the <var title="">old insertion point</var> have the same value as
      the current <a href="#insertion">insertion point</a>. Let the <a
@@ -51494,9 +51509,7 @@
      href="#html-fragment0">HTML fragment parsing algorithm</a>, this is a <a
      href="#parse2">parse error</a>; ignore the token. (<a
      href="#fragment">fragment case</a>)</p>
-    <!-- can only happen for <html>'s own innerHTML or its children's
-    outerHTML -->
-    
+
     <p>Otherwise, switch the <span>insertion mode</span> to "<a
      href="#after12" title="insertion mode: after after body">after after
      body</a>".</p>

Modified: source
===================================================================
--- source	2008-08-11 00:07:08 UTC (rev 2038)
+++ source	2008-08-11 00:25:14 UTC (rev 2039)
@@ -5547,6 +5547,7 @@
   // <span>dynamic markup insertion</span>
            attribute DOMString <span title="dom-innerHTML">innerHTML</span>;
            attribute DOMString <span title="dom-outerHTML">outerHTML</span>;
+  void <span title="dom-insertAdjacentHTML">insertAdjacentHTML</span>(in DOMString position, in DOMString data);
 
   // <span>metadata attributes</span>
            attribute DOMString <span title="dom-id">id</span>;
@@ -6610,20 +6611,13 @@
 
   <h3><dfn>Dynamic markup insertion</dfn></h3>
 
-  <p>The <code title="dom-document-write">document.write()</code>
-  family of methods and the <code
-  title="dom-innerHTML">innerHTML</code>/<code
-  title="dom-outerHTML">outerHTML</code> family of DOM attributes
-  enable script authors to dynamically insert markup into the
-  document.</p>
+  <p>APIs for dynamically inserting markup into the document interact
+  with the parser, and thus their behavior varies depending on whether
+  they are used with <span>HTML documents</span> (and the <span>HTML
+  parser</span>) or XHTML in <span>XML documents</span> (and the
+  <span>XML parser</span>). The following table cross-references the
+  various versions of these APIs.</p>
 
-  <p>Because these APIs interact with the parser, their behavior
-  varies depending on whether they are used with <span>HTML
-  documents</span> (and the <span>HTML parser</span>) or XHTML in
-  <span>XML documents</span> (and the <span>XML parser</span>). The
-  following table cross-references the various versions of these
-  APIs.</p>
-
   <table>
    <thead>
     <tr>
@@ -6652,6 +6646,11 @@
      <td><span title="dom-outerHTML-HTML"><code>outerHTML</code> in HTML</span></td>
      <td><span title="dom-outerHTML-XML">not supported</span></td>
     </tr>
+    <tr>
+     <th><dfn title="dom-insertAdjacentHTML"><code>insertAdjacentHTML()</code></dfn></th>
+     <td><span title="dom-insertAdjacentHTML-HTML"><code>insertAdjacentHTML()</code> in HTML</span></td>
+     <td><span title="dom-insertAdjacentHTML-XML">not supported</span></td>
+    </tr>
    </tbody>
   </table>
 
@@ -6665,8 +6664,9 @@
   <p class="note">The <code title="dom-innerHTML">innerHTML</code>
   attribute applies to both <code>Element</code> nodes as well as
   <code>Document</code> nodes. The <code
-  title="dom-outerHTML">outerHTML</code> attribute, on the other hand,
-  only applies to <code>Element</code> nodes.</p>
+  title="dom-outerHTML">outerHTML</code> and <code
+  title="dom-insertAdjacentHTML">insertAdjacentHTML</code> attributes,
+  on the other hand, only apply to <code>Element</code> nodes.</p>
 
   <p class="note">When inserted using the <code
   title="dom-document-write">document.write()</code> method,
@@ -7080,7 +7080,12 @@
 
   </ol>
 
-  <!-- XXX must make sure we spec that innerHTML causes mutation
+  <hr>
+
+  <p class="big-issue"><dfn title="dom-insertAdjacentHTML-HTML"><code>insertAdjacentHTML()</code></dfn></p>
+
+
+  <!-- XXX must make sure we spec that innerHTML et al causes mutation
   events to fire, but document.write() doesn't. (the latter is already
   req-stated in the parser section, btw) -->
 
@@ -7268,7 +7273,9 @@
 
   <p>In an XML context, the <dfn
   title="dom-document-write-XML"><code>document.write()</code></dfn>
-  method, and the <dfn
+  and <dfn
+  title="dom-insertAdjacentHTML-XML"><code>insertAdjacentHTML()</code></dfn>
+  methods, and the <dfn
   title="dom-outerHTML-XML"><code>outerHTML</code></dfn> attribute on
   both getting and setting, must raise an
   <code>INVALID_ACCESS_ERR</code> exception.</p>
@@ -23536,13 +23543,13 @@
     by an <span>XML parser</span> that itself was created as part of
     the processing of the <code
     title="dom-innerHTML-XML">innerHTML</code> attribute's setter<!--
-    no need to worry about the innerHTML-HTML case, as the HTML parser
-    handles that for us, and outerHTML-XML doesn't work-->, or if the
-    user agent does not <span>support the scripting language</span>
-    given by <var>the script's type</var> for this <code>script</code>
-    element, or if the <code>script</code> element has its
-    <span>"already executed"</span> flag set, then the user agent must
-    abort these steps at this point. The script is not executed.</p>
+    no need to worry about the HTML case, as the HTML parser handles
+    that for us -->, or if the user agent does not <span>support the
+    scripting language</span> given by <var>the script's type</var>
+    for this <code>script</code> element, or if the
+    <code>script</code> element has its <span>"already
+    executed"</span> flag set, then the user agent must abort these
+    steps at this point. The script is not executed.</p>
 
    </li>
 
@@ -43322,9 +43329,10 @@
    something other than a <link> or a <style> element; you'd expect
    that to break out of the <noscript> but it doesn't. This is an edge
    case that doesn't affect the spec, since the algorithm for fragment
-   parsing is only used for innerHTML/outerHTML, where we know
-   scripting is enabled. (XXX except maybe if innerHTML is set from
-   another browsing context on a document with designMode set?) -->
+   parsing is only used for innerHTML/outerHTML/insertAdjacentHTML(),
+   where we know scripting is enabled. (XXX except maybe if innerHTML
+   is set from another browsing context on a document with designMode
+   set?) -->
 
    <li>If <var title="">node</var> is a <code>body</code> element,
    then switch the <span>insertion mode</span> to "<span
@@ -45174,9 +45182,8 @@
   the parser is not mutating the DOM, it is constructing it.) This
   includes the parsing of any content inserted using <code
   title="dom-document-write-HTML">document.write()</code> and <code
-  title="dom-document-writeln">document.writeln()</code> calls.<!--
-  XXX xref --> <a href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p><!-- XXX
-  what about innerHTML? -->
+  title="dom-document-writeln">document.writeln()</code> calls. <a
+  href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
 
   <p class="note">Not all of the tag names mentioned below are
   conformant tag names in this specification; many are included to
@@ -45913,8 +45920,10 @@
     "already executed" prevents it from executing when it is inserted
     into the document a few paragraphs below. Thus, scripts missing
     their end tags and scripts that were inserted using <code
-    title="dom-innerHTML-HTML">innerHTML</code>/<code
-    title="dom-outerHTML-HTML">outerHTML</code> aren't executed.</p>
+    title="dom-innerHTML-HTML">innerHTML</code>, <code
+    title="dom-outerHTML-HTML">outerHTML</code>, or <code
+    title="dom-insertAdjacentHTML-HTML">insertAdjacentHTML()</code>
+    aren't executed.</p>
 
     <p>Let the <var title="">old insertion point</var> have the
     same value as the current <span>insertion point</span>. Let
@@ -48439,8 +48448,6 @@
     <p>If the parser was originally created as part of the <span>HTML
     fragment parsing algorithm</span>, this is a <span>parse
     error</span>; ignore the token.  (<span>fragment case</span>)</p>
-    <!-- can only happen for <html>'s own innerHTML or its children's
-    outerHTML -->
 
     <p>Otherwise, switch the <span>insertion mode</span> to "<span
     title="insertion mode: after after body">after after




More information about the Commit-Watchers mailing list