]> source.dussan.org Git - jquery.git/commitdiff
Ajax: simplify jQuery.parseXML method
authorShivaji Varma <contact@shivajivarma.com>
Wed, 12 Nov 2014 10:29:41 +0000 (15:59 +0530)
committerOleg Gaidarenko <markelog@gmail.com>
Thu, 25 Dec 2014 05:24:37 +0000 (08:24 +0300)
-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

src/ajax/parseXML.js

index 9eeb625ff499757018207b9d93ca7e8f9785cccf..6a40c854a6e995cefc6d3e5de706ea25bd395255 100644 (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;
        }