Ok, after some searching around the web, I believe that
Firefox, Opera, and Safari all implement XMLSerializer,
whilst IE has an 'xml' property on every node.
So here's my XML serializer plugin:

$.fn.serializeXML = function () {
        var out = '';
        if (typeof XMLSerializer == 'function') {
                var xs = new XMLSerializer();
                this.each(function() {
                        out += xs.serializeToString(this);
                });
        } else if (this[0] && this[0].xml != 'undefined') {
                this.each(function() {
                        out += this.xml;
                });
        }
        return out;
};

It seems to work in FF 1.5.0.7 and IE 6, but needs testing
in Opera and Safari.

- Mark Gibson

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to