diff options
author | jaubourg <j@ubourg.net> | 2012-03-07 17:37:14 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2012-03-07 17:37:14 +0100 |
commit | d30859eb6bd5af9aafa9db003e17835ff594d019 (patch) | |
tree | 8c1063cbc91b2dd4d363c0a7ab454b3e0d8bad6e /src/core.js | |
parent | bd56456b1e886c7b03211212ac3c0a6a310b5cde (diff) | |
download | jquery-d30859eb6bd5af9aafa9db003e17835ff594d019.tar.gz jquery-d30859eb6bd5af9aafa9db003e17835ff594d019.zip |
Makes parseXML act like parseJSON when given an empty or non-string input: now returns null rather than throwing an exception. Incidently fixes #10527. Unit tests added.
Diffstat (limited to 'src/core.js')
-rw-r--r-- | src/core.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core.js b/src/core.js index 9a551446b..9c8314c91 100644 --- a/src/core.js +++ b/src/core.js @@ -557,6 +557,9 @@ jQuery.extend({ // Cross-browser xml parsing parseXML: function( data ) { + if ( typeof data !== "string" || !data ) { + return null; + } var xml, tmp; try { if ( window.DOMParser ) { // Standard |