Bug Tracker

Ticket #2567: ajax-filter.diff

File ajax-filter.diff, 1.1 kB (added by flesler, 8 months ago)
  • ajax.js

     
    330330                    // Watch for, and catch, XML document parse errors 
    331331                    try { 
    332332                        // process the data (runs the xml through httpData regardless of callback) 
    333                         data = jQuery.httpData( xml, s.dataType ); 
     333                        data = jQuery.httpData( xml, s.dataType, s.dataFilter ); 
    334334                    } catch(e) { 
    335335                        status = "parsererror"; 
    336336                    } 
     
    454454        return false; 
    455455    }, 
    456456 
    457     httpData: function( r, type ) { 
     457    httpData: function( r, type, filter ) { 
    458458        var ct = r.getResponseHeader("content-type"), 
    459459            xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0, 
    460460            data = xml ? r.responseXML : r.responseText; 
     
    462462        if ( xml && data.documentElement.tagName == "parsererror" ) 
    463463            throw "parsererror"; 
    464464 
     465        // Allow a pre-filtering function to sanitize the response 
     466        if( filter ) 
     467            data = filter( data, type ); 
     468         
    465469        // If the type is "script", eval it in global context 
    466470        if ( type == "script" ) 
    467471            jQuery.globalEval( data );