> var oldInsert = Element.insert;
> Element.insert = function(...) {... fireYourCustomEvent() ...
> oldInsert(...)};

Just for reference, the way that I got this to work in Prototype 1.6
was (hopefully this accounts for all cases):

var prev = {};
["insert","remove","replace","update","wrap"].each(function(s){prev[s]
= Element[s]});
var add = {
        insert: function(){
                var args = $A(arguments), element = $(args.shift()), insertions 
=
args[0], fireEs = [];
                if (Object.isString(insertions) || Object.isNumber(insertions) 
||
                        Object.isElement(insertions) || (insertions &&
(insertions.toElement || insertions.toHTML)))
                        insertions = {bottom:insertions};
        for (position in insertions) {
                position = position.toLowerCase();
                if (position == "before" || position == "after")
                {
                        fireEs.push($(element.parentNode));
                }
                else
                {
                        fireEs.push(element);
                }
        }
        var retVal = prev.insert(element, args);
        fireEs.each(function(e){
                fireE.fire("nodeadded");
                fireE.fire("domchanged");
        });
        },
        remove: function(){
                var args = $A(arguments), element = $(args.shift()), fireE = $
(element.parentNode);
                var retVal = prev.remove(element, args);
                fireE.fire("noderemoved");
                fireE.fire("domchanged");
                return retVal;
        },
        replace: function(){
                var args = $A(arguments), element = $(args.shift()), fireE = $
(element.parentNode);
                var retVal = prev.replace(element, args);
                fireE.fire("noderemoved");
                fireE.fire("nodeadded");
                fireE.fire("domchanged");
                return retVal;
        },
        update: function(){
                var args = $A(arguments), element = $(args.shift());
                var retVal = prev.update(element, args);
                element.fire("domchanged");
                return retVal;
        },
        wrap: function(){
                var args = $A(arguments), element = $(args.shift()), fireE = $
(element.parentNode);
                var retVal = prev.wrap(element, args);
                fireE.fire("nodeadded");
                fireE.fire("domchanged");
                return retVal;
        }
}
Element.addMethods(add);


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to