RE: DOMParser Errors Should Be Exceptions
Note, I filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=17775 to make this change. From: wyc...@gmail.com [mailto:wyc...@gmail.com] On Behalf Of Yehuda Katz Sent: Wednesday, July 11, 2012 9:12 PM To: Tony Ross Cc: João Eiras; public-webapps@w3.org Subject: Re: DOMParser Errors Should Be Exceptions If this is the case, can we consider changing the spec? Yehuda Katz (ph) 718.877.1325 On Wed, May 23, 2012 at 12:38 PM, Tony Ross mailto:tr...@microsoft.com>> wrote: > From: João Eiras [mailto:jo...@opera.com<mailto:jo...@opera.com>] > Opera thrown an exception long time ago and since version 9.5 it changed > the behavior to return the bogus parsererror tree because it caused > yahoo mail to fail back them (among other things). > > While the current behavior of returning the parsererror document is > inappropriate, I afraid it also unchangeable. Has this been examined recently? In IE9+ DOMParser throws an exception when an XML parsing error is encountered. I've yet to hear of this causing a problem. -Tony
Re: DOMParser Errors Should Be Exceptions
If this is the case, can we consider changing the spec? Yehuda Katz (ph) 718.877.1325 On Wed, May 23, 2012 at 12:38 PM, Tony Ross wrote: > > From: João Eiras [mailto:jo...@opera.com] > > > Opera thrown an exception long time ago and since version 9.5 it changed > > the behavior to return the bogus parsererror tree because it caused > > yahoo mail to fail back them (among other things). > > > > While the current behavior of returning the parsererror document is > > inappropriate, I afraid it also unchangeable. > > Has this been examined recently? In IE9+ DOMParser throws an exception > when an XML parsing error is encountered. I've yet to hear of this causing > a problem. > > -Tony >
RE: DOMParser Errors Should Be Exceptions
> From: João Eiras [mailto:jo...@opera.com] > Opera thrown an exception long time ago and since version 9.5 it changed > the behavior to return the bogus parsererror tree because it caused > yahoo mail to fail back them (among other things). > > While the current behavior of returning the parsererror document is > inappropriate, I afraid it also unchangeable. Has this been examined recently? In IE9+ DOMParser throws an exception when an XML parsing error is encountered. I've yet to hear of this causing a problem. -Tony
Re: DOMParser Errors Should Be Exceptions
On Wed, 23 May 2012 21:08:32 +0200, Ms2ger wrote: On 05/23/2012 09:03 PM, Yehuda Katz wrote: In the current DOM parsing spec[1], errors in XML (or SVG) are handled as follows: Let root be a new Element, with its local name set to "parsererror" and its namespace set to "http://www.mozilla.org/newlayout/xml/parsererror.xml";. At this point user agents may append nodes to root, for example to describe the nature of the error. In practice, browsers implement error handling in this way. The output for the following code is given below. (new XMLSerializer).serializeToString((new DOMParser).parseFromString("hi", "text/xml")); As a result, jQuery looks for a parserror tag and re-raises an error when parsing XML[2]. In my view, the DOMParser should throw an exception, and not insert a partially unspecified parserror tag. Thoughts? Opera has reported this is not web-compatible. Ms2ger Opera thrown an exception long time ago and since version 9.5 it changed the behavior to return the bogus parsererror tree because it caused yahoo mail to fail back them (among other things). While the current behavior of returning the parsererror document is inappropriate, I afraid it also unchangeable.
Re: DOMParser Errors Should Be Exceptions
On 05/23/2012 09:03 PM, Yehuda Katz wrote: In the current DOM parsing spec[1], errors in XML (or SVG) are handled as follows: Let root be a new Element, with its local name set to "parsererror" and its namespace set to "http://www.mozilla.org/newlayout/xml/parsererror.xml";. At this point user agents may append nodes to root, for example to describe the nature of the error. In practice, browsers implement error handling in this way. The output for the following code is given below. (new XMLSerializer).serializeToString((new DOMParser).parseFromString("hi", "text/xml")); As a result, jQuery looks for a parserror tag and re-raises an error when parsing XML[2]. In my view, the DOMParser should throw an exception, and not insert a partially unspecified parserror tag. Thoughts? Opera has reported this is not web-compatible. Ms2ger
DOMParser Errors Should Be Exceptions
In the current DOM parsing spec[1], errors in XML (or SVG) are handled as follows: > Let root be a new Element, with its local name set to "parsererror" and its > namespace set to "http://www.mozilla.org/newlayout/xml/parsererror.xml";. > At this point user agents may append nodes to root, for example to describe > the nature of the error. In practice, browsers implement error handling in this way. The output for the following code is given below. (new XMLSerializer).serializeToString((new DOMParser).parseFromString("hi", "text/xml")); As a result, jQuery looks for a parserror tag and re-raises an error when parsing XML[2]. In my view, the DOMParser should throw an exception, and not insert a partially unspecified parserror tag. Thoughts? === Output Webkit: "http://www.w3.org/1999/xhtml"; style="display: block; white-space: pre; border: 2px solid #c77; padding: 0 1em 0 1em; margin: 1em; background-color: #fdd; color: black">This page contains the following errors:error on line 1 at column 7: Extra content at the end of the document Below is a rendering of the page up to the first error.hi" Firefox: "\nhttp://www.mozilla.org/newlayout/xml/parsererror.xml\";>XML Parsing Error: no element found\nLocation: https://getfirebug.com/firstrun#Firebug%201.9.2\nLine Number 1, Column 7:hi\n--^" Opera: "http://www.mozilla.org/newlayout/xml/parsererror.xml";>ErrorUnknown source" [1] http://html5.org/specs/dom-parsing.html [2] https://github.com/jquery/jquery/blob/master/src/core.js#L526-528 Yehuda Katz (ph) 718.877.1325