W3C home > Mailing lists > Public > public-html-diffs@w3.org > February 2011

hixie: Make a parser-inserted script not run if it is moved to another document before it executes (and not even fetch if it is parsed into another document than its parser's document). (whatwg r5883)

From: poot <cvsmail@w3.org>
Date: Mon, 14 Feb 2011 15:49:17 -0500
To: public-html-diffs@w3.org
Message-Id: <E1Pp5MC-0000X9-QS@jay.w3.org>
hixie: Make a parser-inserted script not run if it is moved to another
document before it executes (and not even fetch if it is parsed into
another document than its parser's document). (whatwg r5883)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.4724&r2=1.4725&f=h
http://html5.org/tools/web-apps-tracker?from=5882&to=5883

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.4724
retrieving revision 1.4725
diff -u -d -r1.4724 -r1.4725
--- Overview.html	14 Feb 2011 10:02:44 -0000	1.4724
+++ Overview.html	14 Feb 2011 20:47:53 -0000	1.4725
@@ -13022,6 +13022,15 @@
 
    </li>
 
+   <li>
+
+    <p>If the element is flagged as <a href="#parser-inserted">"parser-inserted"</a>,
+    but the element's <code><a href="#document">Document</a></code> is not the
+    <code><a href="#document">Document</a></code> of the parser that created the element, then
+    abort these steps.</p>
+
+   </li>
+
    <li id="script-processing-noscript">
 
     <p>If <a href="#concept-n-noscript" title="concept-n-noscript">scripting is
@@ -13286,172 +13295,194 @@
   style sheets are blocking which scripts -->
 
   <p>When the user agent is required to <dfn id="execute-the-script-block" title="execute the script
-  block">execute a script block</dfn>, it must act as follows:</p>
+  block">execute a script block</dfn>, it must run the following
+  steps:</p>
 
-  <dl class="switch"><dt>If the load resulted in an error (for example a DNS error, or
-   an HTTP 404 error)</dt>
+  <ol><li>
 
-   <dd><p>Executing the script block must just consist of <a href="#fire-a-simple-event" title="fire a simple event">firing a simple event</a> named
-   <code title="event-error">error</code> at the element.</dd>
+    <p>If the element is flagged as <a href="#parser-inserted">"parser-inserted"</a>,
+    but the element's <code><a href="#document">Document</a></code> is not the
+    <code><a href="#document">Document</a></code> of the parser that created the element, then
+    abort these steps.</p>
 
-   <dt>If the load was successful</dt>
+   </li>
 
-   <!-- SCRIPT EXEC -->
-   <dd>
+   <li>
 
-    <p>Executing the script block must consists of running the
-    following steps. For the purposes of these steps, the script is
-    considered to be from an <i>external file</i> if, while the
-    <a href="#prepare-a-script">prepare a script</a> algorithm above was running for this
-    script, the <code><a href="#script">script</a></code> element had a <code title="attr-script-src"><a href="#attr-script-src">src</a></code> attribute specified.</p>
+    <p>Jump to the appropriate set of steps from the list below:</p>
 
-    <ol><li id="establish-script-block-source">
+    <dl class="switch"><dt>If the load resulted in an error (for example a DNS error, or
+     an HTTP 404 error)</dt>
 
-      <p>Initialize <dfn id="the-script-block-s-source"><var>the script block's source</var></dfn> as
-      follows:</p>
+     <dd><p>Executing the script block must just consist of <a href="#fire-a-simple-event" title="fire a simple event">firing a simple event</a> named
+     <code title="event-error">error</code> at the element.</dd>
 
-      <dl class="switch"><dt>If the script is from an external file and <var><a href="#the-script-block-s-type">the script block's type</a></var> is a text-based language</dt>
+     <dt>If the load was successful</dt>
 
-       <dd>
+     <!-- SCRIPT EXEC -->
+     <dd>
 
-        <p>The contents of that file, interpreted as string of
-        Unicode characters, are the script source.</p>
+      <p>Executing the script block must consists of running the
+      following steps. For the purposes of these steps, the script is
+      considered to be from an <i>external file</i> if, while the
+      <a href="#prepare-a-script">prepare a script</a> algorithm above was running for
+      this script, the <code><a href="#script">script</a></code> element had a <code title="attr-script-src"><a href="#attr-script-src">src</a></code> attribute specified.</p>
 
-        <p>To obtain the string of Unicode characters, the user agent
-        run the following steps:</p>
+      <ol><li id="establish-script-block-source">
 
-        <ol><li><p>If the resource's <a href="#content-type" title="Content-Type">Content
-         Type metadata</a>, if any, specifies a character encoding,
-         and the user agent supports that encoding, then let <var title="">character encoding</var> be that encoding, and jump
-         to the bottom step in this series of steps.</li>
+        <p>Initialize <dfn id="the-script-block-s-source"><var>the script block's source</var></dfn>
+        as follows:</p>
 
-         <li><p>If the algorithm above set <var><a href="#the-script-block-s-character-encoding">the script block's
-         character encoding</a></var>, then let <var title="">character
-         encoding</var> be that encoding, and jump to the bottom step
-         in this series of steps.</li>
+        <dl class="switch"><dt>If the script is from an external file and <var><a href="#the-script-block-s-type">the
+         script block's type</a></var> is a text-based language</dt>
 
-         <li><p>For each of the rows in the following table, starting
-         with the first one and going down, if the file has as many or
-         more bytes available than the number of bytes in the first
-         column, and the first bytes of the file match the bytes given
-         in the first column, then set <var title="">character
-         encoding</var> to the encoding given in the cell in the
-         second column of that row, and jump to the bottom step in
-         this series of steps:</p>
+         <dd>
 
-          <!-- this table is present in several forms in this file; keep them in sync -->
-          <table id="table-script-bom"><thead><tr><th>Bytes in Hexadecimal
-             <th>Encoding
-           <tbody><!-- nobody uses this
-            <tr>
-             <td>00 00 FE FF
-             <td>UTF-32BE
-            <tr>
-             <td>FF FE 00 00
-             <td>UTF-32LE
-  --><tr><td>FE FF
-             <td>Big-endian UTF-16
-            <tr><td>FF FE
-             <td>Little-endian UTF-16
-            <tr><td>EF BB BF
-             <td>UTF-8
-  <!-- nobody uses this
-            <tr>
-             <td>DD 73 66 73
-             <td>UTF-EBCDIC
-  -->
-          </table><p class="note">This step looks for Unicode Byte Order Marks
-          (BOMs).</p>
+          <p>The contents of that file, interpreted as string of
+          Unicode characters, are the script source.</p>
 
-         </li>
+          <p>To obtain the string of Unicode characters, the user
+          agent run the following steps:</p>
 
-         <li><p>Let <var title="">character encoding</var> be <var><a href="#the-script-block-s-fallback-character-encoding">the
-         script block's fallback character encoding</a></var>.</li>
+          <ol><li><p>If the resource's <a href="#content-type" title="Content-Type">Content
+           Type metadata</a>, if any, specifies a character
+           encoding, and the user agent supports that encoding, then
+           let <var title="">character encoding</var> be that
+           encoding, and jump to the bottom step in this series of
+           steps.</li>
 
-         <li><p>Convert the file to Unicode using <var>character
-         encoding</var>, following the rules for doing so given by the
-         specification for <var><a href="#the-script-block-s-type">the script block's
-         type</a></var>.</li>
+           <li><p>If the algorithm above set <var><a href="#the-script-block-s-character-encoding">the script block's
+           character encoding</a></var>, then let <var title="">character
+           encoding</var> be that encoding, and jump to the bottom
+           step in this series of steps.</li>
 
-        </ol></dd>
+           <li><p>For each of the rows in the following table,
+           starting with the first one and going down, if the file has
+           as many or more bytes available than the number of bytes in
+           the first column, and the first bytes of the file match the
+           bytes given in the first column, then set <var title="">character encoding</var> to the encoding given in
+           the cell in the second column of that row, and jump to the
+           bottom step in this series of steps:</p>
 
-       <dt>If the script is from an external file and <var><a href="#the-script-block-s-type">the script block's type</a></var> is an XML-based language</dt>
+            <!-- this table is present in several forms in this file; keep them in sync -->
+            <table id="table-script-bom"><thead><tr><th>Bytes in Hexadecimal
+               <th>Encoding
+             <tbody><!-- nobody uses this
+              <tr>
+               <td>00 00 FE FF
+               <td>UTF-32BE
+              <tr>
+               <td>FF FE 00 00
+               <td>UTF-32LE
+    --><tr><td>FE FF
+               <td>Big-endian UTF-16
+              <tr><td>FF FE
+               <td>Little-endian UTF-16
+              <tr><td>EF BB BF
+               <td>UTF-8
+    <!-- nobody uses this
+              <tr>
+               <td>DD 73 66 73
+               <td>UTF-EBCDIC
+    -->
+            </table><p class="note">This step looks for Unicode Byte Order
+            Marks (BOMs).</p>
 
-       <dd>
+           </li>
 
-        <p>The external file is the script source. When it is later
-        executed, it must be interpreted in a manner consistent with
-        the specification defining the language given by <var><a href="#the-script-block-s-type">the
-        script block's type</a></var>.</p>
+           <li><p>Let <var title="">character encoding</var> be
+           <var><a href="#the-script-block-s-fallback-character-encoding">the script block's fallback character
+           encoding</a></var>.</li>
 
-       </dd>
+           <li><p>Convert the file to Unicode using <var>character
+           encoding</var>, following the rules for doing so given by
+           the specification for <var><a href="#the-script-block-s-type">the script block's
+           type</a></var>.</li>
 
-       <dt>If the script is inline and <var><a href="#the-script-block-s-type">the script block's type</a></var> is a text-based language</dt>
+          </ol></dd>
 
-       <dd>
+         <dt>If the script is from an external file and <var><a href="#the-script-block-s-type">the
+         script block's type</a></var> is an XML-based language</dt>
 
-        <p>The value of the <code title="dom-script-text"><a href="#dom-script-text">text</a></code>
-        IDL attribute at the time the element's <a href="#already-started">"already
-        started"</a> flag was last set is the script source.</p>
+         <dd>
 
-       </dd>
+          <p>The external file is the script source. When it is later
+          executed, it must be interpreted in a manner consistent with
+          the specification defining the language given by <var><a href="#the-script-block-s-type">the
+          script block's type</a></var>.</p>
 
-       <dt>If the script is inline and <var><a href="#the-script-block-s-type">the script block's type</a></var> is an XML-based language</dt>
+         </dd>
 
-       <dd>
+         <dt>If the script is inline and <var><a href="#the-script-block-s-type">the script block's
+         type</a></var> is a text-based language</dt>
 
-        <p>The child nodes of the <code><a href="#script">script</a></code> element at the
-        time the element's <a href="#already-started">"already started"</a> flag was
-        last set are the script source.</p>
+         <dd>
 
-       </dd>
+          <p>The value of the <code title="dom-script-text"><a href="#dom-script-text">text</a></code> IDL attribute at the
+          time the element's <a href="#already-started">"already started"</a> flag was
+          last set is the script source.</p>
 
-      </dl></li>
+         </dd>
 
-     <li>
+         <dt>If the script is inline and <var><a href="#the-script-block-s-type">the script block's
+         type</a></var> is an XML-based language</dt>
 
-      <p>If the script is from an external file, then increment the
-      <a href="#ignore-destructive-writes-counter">ignore-destructive-writes counter</a> of the
-      <code><a href="#script">script</a></code> element's <code><a href="#document">Document</a></code>. Let <var title="">neutralized doc</var> be that
-      <code><a href="#document">Document</a></code>.</p>
+         <dd>
 
-     </li>
+          <p>The child nodes of the <code><a href="#script">script</a></code> element at the
+          time the element's <a href="#already-started">"already started"</a> flag was
+          last set are the script source.</p>
 
-     <li>
+         </dd>
 
-      <p><a href="#create-a-script-from-a-node" title="create a script from a node">Create a
-      script</a> from the <code><a href="#script">script</a></code> element node, using
-      <var><a href="#the-script-block-s-source">the script block's source</a></var> and <var><a href="#the-script-block-s-type">the script
-      block's type</a></var>.</p>
+        </dl></li>
 
-      <p class="note">This is where the script is compiled and
-      actually executed.</p>
+       <li>
 
-     </li>
+        <p>If the script is from an external file, then increment the
+        <a href="#ignore-destructive-writes-counter">ignore-destructive-writes counter</a> of the
+        <code><a href="#script">script</a></code> element's <code><a href="#document">Document</a></code>. Let <var title="">neutralized doc</var> be that
+        <code><a href="#document">Document</a></code>.</p>
 
-     <li>
+       </li>
 
-      <p>Decrement the <a href="#ignore-destructive-writes-counter">ignore-destructive-writes counter</a>
-      of <var title="">neutralized doc</var>, if it was incremented in
-      the earlier step.</p>
+       <li>
 
-     </li>
+        <p><a href="#create-a-script-from-a-node" title="create a script from a node">Create a
+        script</a> from the <code><a href="#script">script</a></code> element node, using
+        <var><a href="#the-script-block-s-source">the script block's source</a></var> and <var><a href="#the-script-block-s-type">the script
+        block's type</a></var>.</p>
 
-     <li>
+        <p class="note">This is where the script is compiled and
+        actually executed.</p>
 
-      <p>If the script is from an external file, <a href="#fire-a-simple-event">fire a simple
-      event</a> named <code title="event-load">load</code> at the
-      <code><a href="#script">script</a></code> element.</p>
+       </li>
 
-      <p>Otherwise, the script is internal; <a href="#queue-a-task">queue a task</a>
-      to <a href="#fire-a-simple-event">fire a simple event</a> named <code title="event-load">load</code> at the <code><a href="#script">script</a></code>
-      element.</p>
+       <li>
 
-     </li>
+        <p>Decrement the <a href="#ignore-destructive-writes-counter">ignore-destructive-writes
+        counter</a> of <var title="">neutralized doc</var>, if it
+        was incremented in the earlier step.</p>
 
-    </ol></dd>
+       </li>
 
-  </dl><p>The IDL attributes <dfn id="dom-script-src" title="dom-script-src"><code>src</code></dfn>, <dfn id="dom-script-type" title="dom-script-type"><code>type</code></dfn>, <dfn id="dom-script-charset" title="dom-script-charset"><code>charset</code></dfn>, and <dfn id="dom-script-defer" title="dom-script-defer"><code>defer</code></dfn>, each must
+       <li>
+
+        <p>If the script is from an external file, <a href="#fire-a-simple-event">fire a simple
+        event</a> named <code title="event-load">load</code> at the
+        <code><a href="#script">script</a></code> element.</p>
+
+        <p>Otherwise, the script is internal; <a href="#queue-a-task">queue a
+        task</a> to <a href="#fire-a-simple-event">fire a simple event</a> named <code title="event-load">load</code> at the <code><a href="#script">script</a></code>
+        element.</p>
+
+       </li>
+
+      </ol></dd>
+
+    </dl></li>
+
+  </ol><p>The IDL attributes <dfn id="dom-script-src" title="dom-script-src"><code>src</code></dfn>, <dfn id="dom-script-type" title="dom-script-type"><code>type</code></dfn>, <dfn id="dom-script-charset" title="dom-script-charset"><code>charset</code></dfn>, and <dfn id="dom-script-defer" title="dom-script-defer"><code>defer</code></dfn>, each must
   <a href="#reflect">reflect</a> the respective content attributes of the same
   name.</p>
Received on Monday, 14 February 2011 20:49:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 14 February 2011 20:49:20 GMT