Element.extend = function(element) {
if (!element) return;
if (!element._extendedMethods) element._extendedMethods = {}
if (!element._extended && element.tagName && element != window) {
var methods = Element.Methods ;
for (property in methods) {
if (typeof methods[property] == 'function')
element[property] = Element.callExtended(property);
}
}
element._extended = true;
return element;
}
Element.callExtended = function(property) {
return new Function("args = $A([this]).zip($A(arguments)).flatten(); return Element.Methods."+property+".apply(this, args)");
}
Such a small change for the amount of hair I must have lost.
** If anyone can come up with a better alternative to the line:
args = $A([this]).zip($A(arguments)).flatten();
i.e. without needing to use flatten, let me know.
On 5/9/06, nick hemsley <[EMAIL PROTECTED]> wrote:
Turns out this is causing (at least some) of the problems I have been having with IE bloating.
The culprit as far as I can tell is the bind call (anon function & dom element, not too sure why this is a circular reference though) in Element.extend. I have been having a poke around, but I can't think of a way to stop this unless element.extend keeps a list of all extended elements & does something at the appropriate time to release them.
NickOn 5/9/06, Joel Shellman <[EMAIL PROTECTED]> wrote:Had a nasty memory leak that was seriously slowing down the browser and
eating up a couple megabytes every reload. I was using:
$$('.dyntable').each(function(elm) { new DynTable(elm) });
To set up my behavior, but discovered that just running:
$$('.dyntable');
Caused the memory leak all by itself.
The fix I found for it was to change Element.extend to a noop.
Element.extend = function(element) {
return element;
}
Apparently IE has that leak where it can't recognize these enhanced DOM
elements as ready for garbage collection because of this enhancement.
FYI: this was on latest IE 6 on WinXP.
-joel
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs