This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25294 - DOMParser.parseFromString with application/whatever+xml
Summary: DOMParser.parseFromString with application/whatever+xml
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM Parsing and Serialization (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Travis Leithead [MSFT]
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-08 21:03 UTC by David Junger
Modified: 2014-10-04 16:45 UTC (History)
7 users (show)

See Also:


Attachments

Description David Junger 2014-04-08 21:03:28 UTC
The specification disallows any type for DOMParser.parseFromString that isn't enumerated. That means anything except SVG and XHTML has to pretend to be generic XML, even though SVG and XHTML don't actually get any special treatment from the algorithm, so why not let other XML types be honest about what they are and use their full MIME type?
Right now Webkit browsers actually behave that way (i.e. you can use "application/whatever+xml" as the second argument to parseFromString and they won't throw an error), while Firefox follows the spec to the letter.
Comment 1 Olli Pettay 2014-04-08 21:10:55 UTC
So what is the use case you have?
If you just want a Document created from a string, why don't you pass
"text/xml"?
Comment 2 Boris Zbarsky 2014-04-08 21:17:21 UTC
Note that Blink also follows the spec here.
Comment 3 David Junger 2014-04-08 21:25:07 UTC
I know I can just pass "application/xml" or "text/xml". I just don't like that the DOMParser as specified uses an argument that *looks* like a MIME type but doesn't behave accordingly. It's misleading, especially with disagreeing implementations.
If you want a small enumeration, why not just use {"html", "xml"} and nothing else, since that's what really matters for the algorithm at this point? but it's too late for that, so loosening the definition would be the next best thing.
Comment 4 Ms2ger 2014-04-09 13:35:39 UTC
I don't see a particularly compelling argument to change the spec and implementations here.
Comment 5 Elliott Sprehn 2014-04-09 22:58:59 UTC
WebKit also follows the spec:

http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/xml/DOMParser.cpp

I'm not sure what the original poster is referring to.
Comment 6 Boris Zbarsky 2014-04-09 23:42:11 UTC
The latest version of Safari on OS 10.8, for example, has different behavior from WebKit nightlies here.