jQuery.error( "Invalid JSON: " + data );
}
},
+
+ // Cross-browser xml parsing
+ // (xml & tmp used internally)
+ parseXML: function( data , xml , tmp ) {
+
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+
+ tmp = xml.documentElement;
+
+ if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+
+ return xml;
+ },
noop: function() {},
deferred = {
// then( f1, f2, ...)
- then: function() {
+ then: function () {
if ( ! cancelled ) {
var args = arguments,
i,
+ length,
+ elem,
type,
_fired;
fired = 0;
}
- for ( i in args ) {
- i = args[ i ];
- type = jQuery.type( i );
+ for ( i = 0, length = args.length ; i < length ; i++ ) {
+ elem = args[ i ];
+ type = jQuery.type( elem );
if ( type === "array" ) {
- this.then.apply( this , i );
+ deferred.then.apply( deferred , elem );
} else if ( type === "function" ) {
- callbacks.push( i );
+ callbacks.push( elem );
}
}