Author: jmorliaguet
Date: Thu Mar 30 20:10:14 2006
New Revision: 2747
Modified:
cpsskins/branches/jmo-perspectives/ui/framework/prototype.js
Log:
prototype.js update
* Cache methods added to DOM elements with Element.extend to prevent memory
leaks in IE. Closes #4465. [EMAIL PROTECTED], sam]
Modified: cpsskins/branches/jmo-perspectives/ui/framework/prototype.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/prototype.js
(original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/prototype.js Thu Mar
30 20:10:14 2006
@@ -902,11 +902,11 @@
if (!element) return;
if (!element._extended && element.tagName && element != window) {
- var methods = Element.Methods;
+ var methods = Element.Methods, cache = Element.extend.cache;
for (property in methods) {
var value = methods[property];
if (typeof value == 'function')
- element[property] = value.bind(null, element);
+ element[property] = cache.findOrStore(value);
}
}
@@ -914,6 +914,14 @@
return element;
}
+Element.extend.cache = {
+ findOrStore: function(value) {
+ return this[value] = this[value] || function() {
+ return value.apply(null, [this].concat($A(arguments)));
+ }
+ }
+}
+
Element.Methods = {
visible: function(element) {
return $(element).style.display != 'none';
--
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins