Skip to content

Commit 5a0867d

Browse files
shivajivarmamarkelog
authored andcommitted
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 jquerygh-1856
1 parent 4ab8603 commit 5a0867d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/ajax/parseXML.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ define([
44

55
// Cross-browser xml parsing
66
jQuery.parseXML = function( data ) {
7-
var xml, tmp;
7+
var xml;
88
if ( !data || typeof data !== "string" ) {
99
return null;
1010
}
1111

1212
// Support: IE9
1313
try {
14-
tmp = new DOMParser();
15-
xml = tmp.parseFromString( data, "text/xml" );
14+
xml = ( new DOMParser() ).parseFromString( data, "text/xml" );
1615
} catch ( e ) {
1716
xml = undefined;
1817
}

0 commit comments

Comments
 (0)