Skip to content

Commit f51c255

Browse files
Move DOMParser to HTML
Follows whatwg/html#5190. Co-Authored-By: Michael[tm] Smith <[email protected]>
1 parent 35d37e3 commit f51c255

File tree

1 file changed

+11
-84
lines changed

1 file changed

+11
-84
lines changed

index.html

Lines changed: 11 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -205,88 +205,16 @@ <h2>Extensibility</h2>
205205

206206
<section><h2>The <code>DOMParser</code> interface</h2>
207207

208-
<pre class=idl>
209-
[Exposed=Window]
210-
interface DOMParser {
211-
constructor();
212-
[NewObject] Document parseFromString(DOMString str, SupportedType type);
213-
};
214-
215-
enum SupportedType {
216-
"text/html",
217-
"text/xml",
218-
"application/xml",
219-
"application/xhtml+xml",
220-
"image/svg+xml"
221-
};
222-
</pre>
223-
224-
<dl class=domintro>
225-
<dt><var>domparser</var> = new <a data-link-for=DOMParser>DOMParser</a> ()</var>
226-
<dd>Constructs a new DOMParser object.
227-
228-
<dt><var>document</var> = <var>domparser</var> . <a data-link-for=DOMParser>parseFromString</a> ( <var>str</var>, <var>type</var> )
229-
<dd>Parse <var>str</var> using a parser that matches <var>type</var>'s supported MIME types
230-
(either XML or HTML), and return a <a>Document</a> object contained the parsed content if
231-
successful. If not successful, returns a <a>Document</a> describing the error.
232-
<dd>If <var>type</var> does not match a value in the <a>SupportedType</a> enumeration, an
233-
exception is thrown [[WEBIDL]].
234-
</dl>
208+
<span id="dom-domparser"></span>
209+
<span id="dom-domparser-parsefromstring"></span>
210+
<span id="idl-def-supportedtype"></span>
211+
<span id="dom-supportedtype-text/html"></span>
212+
<span id="dom-supportedtype-text/xml"></span>
213+
<span id="dom-supportedtype-application/xml"></span>
214+
<span id="dom-supportedtype-application/xhtml+xml"></span>
215+
<span id="dom-supportedtype-image/svg+xml"></span>
235216

236-
<p>The <dfn><code>DOMParser</code></dfn> constructor must return a new <a>DOMParser</a> object.
237-
238-
<p>The
239-
<code><dfn data-dfn-for=DOMParser>parseFromString</dfn>(<var>str</var>, <var>type</var>)</code></dfn>
240-
method must run these steps, depending on <var>type</var>:
241-
242-
<dl class=switch>
243-
<dt>"<dfn data-dfn-for=SupportedType><code>text/html</code></dfn>"
244-
<dd>Parse <var>str</var> with an <code><a>HTML parser</a></code>, and return the newly created
245-
<a>Document</a>.
246-
247-
<p>The <a>scripting flag</a> must be set to "disabled".
248-
249-
<p class=note><code><a>meta</a></code> elements are not taken into account for the encoding
250-
used, as a Unicode stream is passed into the parser.
251-
252-
<p class=note><code><a>script</a></code> elements get marked unexecutable and the contents of
253-
<code><a>noscript</a></code> get parsed as markup.
254-
<dt>"<dfn data-dfn-for=SupportedType><code>text/xml</code></dfn>"
255-
<dt>"<dfn data-dfn-for=SupportedType><code>application/xml</code></dfn>"
256-
<dt>"<dfn data-dfn-for=SupportedType><code>application/xhtml+xml</code></dfn>"
257-
<dt>"<dfn data-dfn-for=SupportedType><code>image/svg+xml</code></dfn>"
258-
<dd>
259-
<ol>
260-
<li>Parse <var>str</var> with a namespace-enabled <code><a>XML parser</a></code>.
261-
262-
<p class=note>For all XHTML <code><a>script</a></code> elements parsed using the
263-
<code><a>XML parser</a></code>, the equivalent of the <a>scripting flag</a> must be set to
264-
"disabled".</p>
265-
266-
<li>If the previous step didn't return an error, return the newly created <a>Document</a>.
267-
268-
<li>Let <var>document</var> be a newly-created <a>XML Document</a>. <span class=note>The
269-
<var>document</var> will use the <code><a>Document</a></code> interface rather than the
270-
<code><a>XMLDocument</a></code> interface.</span>
271-
272-
<li>Let <var>root</var> be a new <code><a>Element</a></code>, with its <a>local name</a> set
273-
to "<code>parsererror</code>" and its <a data-lt="concept namespace">namespace</a> set to
274-
"<code>http://www.mozilla.org/newlayout/xml/parsererror.xml</code>".
275-
276-
<p>At this point user agents may <a>append</a> nodes to <var>root</var>, for example to
277-
describe the nature of the error.
278-
279-
<li><a>Append</a> <var>root</var> to <var>document</var>.
280-
281-
<li>Return the value of <var>document</var>.
282-
</ol>
283-
</dl>
284-
285-
<p>In any case, the returned <a>Document</a>'s <a>content type</a> must be the <var>type</var>
286-
argument. Additionally, the <a>Document</a> must have a <a>URL</a> value equal to the URL of the
287-
<a>active document</a>, and a <a>location</a> value of <code>null</code>.
288-
289-
<p class=note>The returned <a>Document</a>'s <a>encoding</a> is the default, UTF-8.
217+
<p>The definition of <code>DOMParser</code> has moved to <a href="https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparser">the HTML Standard</a>.</p>
290218

291219
</section><!-- end DOMParser interface -->
292220

@@ -1807,7 +1735,7 @@ <h2>Dependencies</h2>
18071735
"<dfn><a href="https://www.w3.org/TR/dom/#syntaxerror">SyntaxError</a></dfn>",
18081736
<li><dfn><a href="https://www.w3.org/TR/dom/#xmldocument">XMLDocument</a></dfn>
18091737
</ul>
1810-
1738+
18111739
The following terms used in this document are defined by [[DOM]]:
18121740

18131741
<ul>
@@ -1844,7 +1772,7 @@ <h2>Revision History</h2>
18441772

18451773
<ul>
18461774
<li>2016-06 WD - Editorial restructuring of the document; monolithic XML serialization algorithm
1847-
factored into sections. Dependencies clarified. XML Serialization algorithm updated to get
1775+
factored into sections. Dependencies clarified. XML Serialization algorithm updated to get
18481776
closer to interoperable browser behavior.
18491777

18501778
<li><a href="https://dvcs.w3.org/hg/innerhtml/raw-file/tip/LC2_comments.html">Incorporated
@@ -1877,4 +1805,3 @@ <h2>Acknowledgements</h2>
18771805

18781806
</body>
18791807
</html>
1880-

0 commit comments

Comments
 (0)