Ajax: simplify jQuery.parseXML method

-2 bytes to the gzipped size and code looks a bit nicer

This wasn't landed to the compat branch though, since size would increase
with this cherry-pick

Closes gh-1856
This commit is contained in:
Shivaji Varma 2014-11-12 15:59:41 +05:30 committed by Oleg Gaidarenko
parent 4ab8603669
commit 5a0867d1e9

View File

@ -4,15 +4,14 @@ define([
// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
var xml, tmp;
var xml;
if ( !data || typeof data !== "string" ) {
return null;
}
// Support: IE9
try {
tmp = new DOMParser();
xml = tmp.parseFromString( data, "text/xml" );
xml = ( new DOMParser() ).parseFromString( data, "text/xml" );
} catch ( e ) {
xml = undefined;
}