mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
2.0: Reduced parseXML
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
This commit is contained in:
parent
338eaf6181
commit
155dbad029
17
src/core.js
17
src/core.js
@ -486,19 +486,16 @@ jQuery.extend({
|
|||||||
if ( !data || typeof data !== "string" ) {
|
if ( !data || typeof data !== "string" ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IE9 will throw on ill-formed XML
|
||||||
try {
|
try {
|
||||||
if ( window.DOMParser ) { // Standard
|
tmp = new DOMParser();
|
||||||
tmp = new DOMParser();
|
xml = tmp.parseFromString( data , "text/xml" );
|
||||||
xml = tmp.parseFromString( data , "text/xml" );
|
} catch ( e ) {
|
||||||
} else { // IE
|
|
||||||
xml = new ActiveXObject( "Microsoft.XMLDOM" );
|
|
||||||
xml.async = "false";
|
|
||||||
xml.loadXML( data );
|
|
||||||
}
|
|
||||||
} catch( e ) {
|
|
||||||
xml = undefined;
|
xml = undefined;
|
||||||
}
|
}
|
||||||
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
|
|
||||||
|
if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
|
||||||
jQuery.error( "Invalid XML: " + data );
|
jQuery.error( "Invalid XML: " + data );
|
||||||
}
|
}
|
||||||
return xml;
|
return xml;
|
||||||
|
Loading…
Reference in New Issue
Block a user