HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2064Tighten up document.open()'s type argument processing.2008-08-12 23:59
@@ -6770,26 +6770,43 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0
    that it can be closed by the <code
    title="dom-document-open">document.open()</code> and <code
    title="dom-document-close">document.close()</code> methods, and
    that the tokeniser will wait for an explicit call to <code
    title="dom-document-close">document.close()</code> before emitting
    an end-of-file token).</p></li>
 
    <li>Mark the document as being an <span title="HTML documents">HTML
    document</span> (it might already be so-marked).</li>
 
-   <!-- text/plain handling --><li><p>If <var title="">type</var> does
-   not have the value "<code>text/html</code>"<!-- XXX matched how?
-   -->, then act as if the tokeniser had emitted a start tag token
-   with the tag name "pre", then set the <span>HTML parser</span>'s
-   <span>tokenization</span> stage's <span>content model flag</span>
-   to <em>PLAINTEXT</em>.</p></li>
+   <li>
+
+    <!-- text/plain handling -->
+
+    <p>If <var title="">type</var> is an <span>ASCII
+    case-insensitive</span> match for the stirng
+    "<code>text/plain</code>", then act as if the tokeniser had
+    emitted a start tag token with the tag name "pre", then set the
+    <span>HTML parser</span>'s <span>tokenization</span> stage's
+    <span>content model flag</span> to <em>PLAINTEXT</em>.</p>
+
+    <p class="note">All other values are treated as
+    <code>text/html</code>.</p>
+
+    <!--
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20%0D%0A%20%20var%20d%20%3D%20document.getElementsByTagName('iframe')%5B0%5D.contentDocument%3B%0D%0A%20%20d.open('image%2Fsvg%2Bxml')%3B%0D%0A%20%20d.write(%22%3Cinput%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%20value%3D'(x)html'%2F%3E%22)%3B%0D%0A%20%20d.close()%3B%0D%0A%7D%3B%3C%2Fscript%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20%7B%20%0D%0A%20%20var%20d%20%3D%20document.getElementsByTagName('iframe')%5B0%5D.contentDocument%3B%0D%0A%20%20d.open('image%2Fgif')%3B%0D%0A%20%20var%20a%20%3D%20%5B%200x47%2C%200x49%2C%200x46%2C%200x38%2C%200x39%2C%200x61%2C%200x01%2C%200x00%2C%200x01%2C%200x00%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200x80%2C%200xff%2C%200x00%2C%200xc0%2C%200xc0%2C%200xc0%2C%200x00%2C%200x00%2C%200x00%2C%200x21%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200xf9%2C%200x04%2C%200x01%2C%200x00%2C%200x00%2C%200x00%2C%200x00%2C%200x2c%2C%200x00%2C%200x00%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200x00%2C%200x00%2C%200x01%2C%200x00%2C%200x01%2C%200x00%2C%200x00%2C%200x02%2C%200x02%2C%200x44%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%200x01%2C%200x00%2C%200x3b%20%5D%3B%0D%0A%20%20var%20s%20%3D%20%22%22%3B%0D%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20a.length%3B%20i%20%2B%3D%201)%0D%0A%20%20%20%20s%20%2B%3D%20String.fromCharCode(a%5Bi%5D)%3B%0D%0A%20%20d.write(s)%3B%0D%0A%20%20d.close()%3B%0D%0A%7D%3B%3C%2Fscript%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20{%20%0A%20%20var%20d%20%3D%20document.getElementsByTagName(%27iframe%27)[0].contentDocument%3B%0A%20%20d.open(%27Text%2Fplain%27)%3B%0A%20%20d.write(%27%3Cb%3Etest%27)%3B%0A%20%20d.close()%3B%0A}%3B%3C%2Fscript%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20{%20%0A%20%20var%20d%20%3D%20document.getElementsByTagName(%27iframe%27)[0].contentDocument%3B%0A%20%20d.open(%27%20text%2Fplain%27)%3B%0A%20%20d.write(%27%3Cb%3Etest%27)%3B%0A%20%20d.close()%3B%0A}%3B%3C%2Fscript%3E
+ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E...%3Ciframe%3E%3C%2Fiframe%3E%3Cscript%3Eonload%20%3D%20function%20()%20{%20%0A%20%20var%20d%20%3D%20document.getElementsByTagName(%27iframe%27)[0].contentDocument%3B%0A%20%20d.open(%27text%2Fplain%3B%27)%3B%0A%20%20d.write(%27%3Cb%3Etest%27)%3B%0A%20%20d.close()%3B%0A}%3B%3C%2Fscript%3E
+    -->
+
+   </li>
 
    <li>
 
     <p>If <var title="">replace</var> is false, then:
 
     <ol>
 
      <li>Remove all the entries in the <span>browsing context</span>'s
      <span>session history</span> after the <span>current entry</span>
      in its <code>Document</code>'s <code>History</code> object</li>
@@ -6811,28 +6828,20 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0
 
    <li><p>Finally, set the <span>insertion point</span> to point at
    just before the end of the <span>input stream</span> (which at this
    point will be empty).</p></li>
 
    <li><p>Return the <code>Document</code> on which the method was
    invoked.</p></li>
 
   </ol>
 
-  <p class="big-issue">We shouldn't hard-code <code>text/plain</code>
-  there. We should do it some other way, e.g. hand off to the section
-  on content-sniffing and handling of incoming data streams, the part
-  that defines how this all works when stuff comes over the
-  network.</p>
-
-  <!-- XXX Should we support XML/XHTML as a type to that method? -->
-
   <p>When called with three or more arguments, the <code
   title="dom-document-open">open()</code> method on the
   <code>HTMLDocument</code> object must call the <code
   title="dom-open">open()</code> method on the <code>Window</code>
   interface of the object returned by the <code
   title="dom-document-defaultView">defaultView</code> attribute of the
   <code>DocumentView</code> interface of the <code>HTMLDocument</code>
   object, with the same arguments as the original call to the <code
   title="dom-document-open">open()</code> method, and return whatever
   that method returned. If the <code

|