/*
MooTools 1.2 Custom Backwards-Compatibility Library
By David Isaacson
Portions from Mootools 1.2 by the MooTools production team (http://mootools.net/developers/)
Copyright (c) 2006-2007 Valerio Proietti (http://mad4milk.net/)
Copyright (c) 2008 Siafoo.net

Load after Mootools Core and More and both compatibility files
*/

// This is the definition from Mootools 1.2, with error handling
// to prevent an issue in IE where calling .item on an XML (non-HTML)
// element raises an error.
//
// We're using the 1.2 version in the first place because the compat version throws *other* weird errors sometimes
// Note that this will prevent you from using the $A(iterable, start, length) syntax allowed but undocumented (?) in Mootools 1.1



// Completely broken in mootools-core-compat.js
XHR.implement({

    initialize: function(options){
        this.parent(options);
        this.transport = this.xhr;
    }
});

var Ajax = new Class({
    Extends: XHR,

    initialize: function(url, options){
        this.url = url;
        this.parent(options);
    },

    success: function(text, xml){
        // This version processes scripts *after* the update element is updated, like Mootools 1.1's Ajax class
        // Partially from Mootools 1.2 Remote.processScripts()
        stripped = text.stripScripts(this.options.evalScripts);
        if (this.options.update) $(this.options.update).empty().set('html', stripped);
        text = this.processScripts(text);
        this.onSuccess(text, xml);
    }

});

/* For further information, read http://www.siafoo.net/article/62 */

