Bug Tracker

Modify

Ticket #9255 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

jQuery.parseXML error handling does not work in webkit browsers

Reported by: Jan Harmsen Owned by:
Priority: high Milestone: 1.6.3
Component: ajax Version: 1.6
Keywords: Cc: jaubourg
Blocking: Blocked by:

Description

When using jQuery.parseXML() to parse an invalid (not well-formed) XML string, jQuery does not throw an error in Webkit-based browsers. Thus jQuery.parseXML error handling is not reliable.

tested on Chrome 11 and Safari 5.0.5 on OS X 10.6.7

Testcase:  http://jsfiddle.net/shfHD/

References:  http://www.thespanner.co.uk/2011/03/21/blog-fight-round-two/  https://bugs.webkit.org/show_bug.cgi?id=13057

Change History

comment:1 Changed 3 years ago by dmethvin

  • Status changed from new to open

Yep, it looks like some browsers throw an error and some return an error document that has to be parsed to check for success. DOMParser.parseFromString isn't part of the standard but it seems like jQuery should provide consistent behavior -- either throw an error or return an error document.

comment:2 Changed 3 years ago by timmywil

  • Priority changed from undecided to high
  • Component changed from unfiled to ajax

comment:3 Changed 3 years ago by john

This was confirmed during bug triage.

comment:4 Changed 3 years ago by jaubourg

  • Status changed from open to closed
  • Resolution set to fixed

Fixes #9255: xml parsing error in $.parseXML is now properly detected for all browsers. Unit test added.

Changeset: 27291ff06ddb655f90a8d1eada71f7ac61499b12

comment:5 Changed 3 years ago by jaubourg

  • Milestone changed from 1.next to 1.6.3

comment:6 Changed 3 years ago by jaubourg

  • Cc jaubourg added

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.