Commits

ms2ger committed e978cc4

Comments (0)

Files changed (2)

 
 <h2 id=the-domparser-interface><span class=secno>4 </span>The <a href=#domparser><code>DOMParser</code></a> interface</h2>
 <pre class=idl>enum <dfn id=supportedtype>SupportedType</dfn> {
+  "text/html",
   "text/xml",
   "application/xml",
   "application/xhtml+xml",
 
 <p>The
 <dfn id=dom-domparser-parsefromstring title=dom-DOMParser-parseFromString><code>parseFromString(<var title="">str</var>, <var title="">type</var>)</code></dfn>
-method must run these steps:
-<ol>
- <li><p>Parse <var title="">str</var> with a namespace-enabled
- <a class=external data-anolis-spec=html href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#xml-parser>XML parser</a>.
+method must run these steps, depending on <var title="">type</var>:
+<dl class=switch>
+  <dt>"<code title="">text/html</code>"
+  <dd>
+    <p>Parse <var title="">str</var> with an
+    <a class=external data-anolis-spec=html href=http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#html-parser>HTML parser</a>, and return the newly
+    created <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-document title=concept-document>document</a>.
 
- <li><p>If the previous step didn't return an error, return the newly
- created <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-document title=concept-document>document</a>
- and terminate these steps.
+    <p>The <a class=external data-anolis-spec=html href=http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#scripting-flag>scripting flag</a> must be set to
+    "disabled".
 
- <li><p>Let <var title="">document</var> be a newly-created
- <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#xmldocument><code class=external data-anolis-spec=dom>XMLDocument</code></a>.
+    <p class=note><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-meta-element><code class=external data-anolis-spec=html>meta</code></a> elements are not
+    taken into account for the encoding used, as a Unicode stream is passed into
+    the parser.
 
- <li>
-  <p>Let <var title="">root</var> be a new
-  <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element><code class=external data-anolis-spec=dom>Element</code></a>, with its
-  <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-local-name title=concept-element-local-name>local name</a>
-  set to "<code title="">parsererror</code>" and its
-  <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-namespace title=concept-element-namespace>namespace</a>
-  set to
-  "<code title="">http://www.mozilla.org/newlayout/xml/parsererror.xml</code>".
+    <p class=note><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#the-script-element><code class=external data-anolis-spec=html>script</code></a> elements get marked
+    unexecutable and the contents of <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#the-noscript-element><code class=external data-anolis-spec=html>noscript</code></a>
+    get parsed as markup.
 
-  <p>At this point user agents may
-  <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-append title=concept-node-append>append</a> nodes
-  to <var title="">root</var>, for example to describe the nature of the error.
+  <dt>"<code title="">text/xml</code>"
+  <dt>"<code title="">application/xml</code>"
+  <dt>"<code title="">application/xhtml+xml</code>"
+  <dt>"<code title="">image/svg+xml</code>"
+  <dd>
+    <ol>
+      <li><p>Parse <var title="">str</var> with a namespace-enabled
+      <a class=external data-anolis-spec=html href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#xml-parser>XML parser</a>.
 
- <li><p><a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-append title=concept-node-append>Append</a>
- <var title="">root</var> to <var title="">document</var>.
+      <li><p>If the previous step didn't return an error, return the newly
+      created <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-document title=concept-document>document</a>
+      and terminate these steps.
 
- <li><p>Return <var title="">document</var>.
-</ol>
+      <li><p>Let <var title="">document</var> be a newly-created
+      <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#xmldocument><code class=external data-anolis-spec=dom>XMLDocument</code></a>.
 
-<p>In either case, the returned
+      <li>
+        <p>Let <var title="">root</var> be a new
+        <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#element><code class=external data-anolis-spec=dom>Element</code></a>, with its
+        <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-local-name title=concept-element-local-name>local name</a>
+        set to "<code title="">parsererror</code>" and its
+        <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-namespace title=concept-element-namespace>namespace</a>
+        set to
+        "<code title="">http://www.mozilla.org/newlayout/xml/parsererror.xml</code>".
+
+        <p>At this point user agents may
+        <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-append title=concept-node-append>append</a> nodes
+        to <var title="">root</var>, for example to describe the nature of the
+        error.
+
+      <li><p><a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-append title=concept-node-append>Append</a>
+      <var title="">root</var> to <var title="">document</var>.
+
+      <li><p>Return <var title="">document</var>.
+    </ol>
+</dl>
+
+<p>In any case, the returned
 <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-document title=concept-document>document</a>'s
 <a class=external data-anolis-spec=dom href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-document-content-type title=concept-document-content-type>content type</a>
 must be the <var title="">type</var> argument, and its
 
 <h2>The <code>DOMParser</code> interface</h2>
 <pre class=idl>enum <dfn>SupportedType</dfn> {
+  "text/html",
   "text/xml",
   "application/xml",
   "application/xhtml+xml",
 
 <p>The
 <dfn title=dom-DOMParser-parseFromString><code>parseFromString(<var title>str</var>, <var title>type</var>)</code></dfn>
-method must run these steps:
-<ol>
- <li><p>Parse <var title>str</var> with a namespace-enabled
- <span data-anolis-spec=html>XML parser</span>.
+method must run these steps, depending on <var title>type</var>:
+<dl class=switch>
+  <dt>"<code title>text/html</code>"
+  <dd>
+    <p>Parse <var title>str</var> with an
+    <span data-anolis-spec=html>HTML parser</span>, and return the newly
+    created <span title=concept-document data-anolis-spec=dom>document</span>.
 
- <li><p>If the previous step didn't return an error, return the newly
- created <span title=concept-document data-anolis-spec=dom>document</span>
- and terminate these steps.
+    <p>The <span data-anolis-spec=html>scripting flag</span> must be set to
+    "disabled".
 
- <li><p>Let <var title>document</var> be a newly-created
- <code data-anolis-spec=dom>XMLDocument</code>.
+    <p class=note><code data-anolis-spec=html>meta</code> elements are not
+    taken into account for the encoding used, as a Unicode stream is passed into
+    the parser.
 
- <li>
-  <p>Let <var title>root</var> be a new
-  <code data-anolis-spec=dom>Element</code>, with its
-  <span title=concept-element-local-name data-anolis-spec=dom>local name</span>
-  set to "<code title>parsererror</code>" and its
-  <span title=concept-element-namespace data-anolis-spec=dom>namespace</span>
-  set to
-  "<code title>http://www.mozilla.org/newlayout/xml/parsererror.xml</code>".
+    <p class=note><code data-anolis-spec=html>script</code> elements get marked
+    unexecutable and the contents of <code data-anolis-spec=html>noscript</code>
+    get parsed as markup.
 
-  <p>At this point user agents may
-  <span data-anolis-spec=dom title=concept-node-append>append</span> nodes
-  to <var title>root</var>, for example to describe the nature of the error.
+  <dt>"<code title>text/xml</code>"
+  <dt>"<code title>application/xml</code>"
+  <dt>"<code title>application/xhtml+xml</code>"
+  <dt>"<code title>image/svg+xml</code>"
+  <dd>
+    <ol>
+      <li><p>Parse <var title>str</var> with a namespace-enabled
+      <span data-anolis-spec=html>XML parser</span>.
 
- <li><p><span data-anolis-spec=dom title=concept-node-append>Append</span>
- <var title>root</var> to <var title>document</var>.
+      <li><p>If the previous step didn't return an error, return the newly
+      created <span title=concept-document data-anolis-spec=dom>document</span>
+      and terminate these steps.
 
- <li><p>Return <var title>document</var>.
-</ol>
+      <li><p>Let <var title>document</var> be a newly-created
+      <code data-anolis-spec=dom>XMLDocument</code>.
 
-<p>In either case, the returned
+      <li>
+        <p>Let <var title>root</var> be a new
+        <code data-anolis-spec=dom>Element</code>, with its
+        <span title=concept-element-local-name data-anolis-spec=dom>local name</span>
+        set to "<code title>parsererror</code>" and its
+        <span title=concept-element-namespace data-anolis-spec=dom>namespace</span>
+        set to
+        "<code title>http://www.mozilla.org/newlayout/xml/parsererror.xml</code>".
+
+        <p>At this point user agents may
+        <span data-anolis-spec=dom title=concept-node-append>append</span> nodes
+        to <var title>root</var>, for example to describe the nature of the
+        error.
+
+      <li><p><span data-anolis-spec=dom title=concept-node-append>Append</span>
+      <var title>root</var> to <var title>document</var>.
+
+      <li><p>Return <var title>document</var>.
+    </ol>
+</dl>
+
+<p>In any case, the returned
 <span title=concept-document data-anolis-spec=dom>document</span>'s
 <span title=concept-document-content-type data-anolis-spec=dom>content type</span>
 must be the <var title>type</var> argument, and its