Skip to content
Browse files

Applied the suggestions

revert dispose, destroy now filter nodeType, so Element.properties.text
can use empty without throwing errors, delete properties in clean.
  • Loading branch information...
1 parent 86611be commit f59f069d20ea44b8496333f56eef8c012ae34a6c @kentaromiura committed
Showing with 11 additions and 6 deletions.
  1. +11 −6 Source/Element/Element.js
View
17 Source/Element/Element.js
@@ -792,6 +792,11 @@ var clean = function(item){
delete collected[uid];
delete storage[uid];
}
+ var props = ['_fireEvent','$family','$constructor'];
+ props.each(function(property){
+ if(property in item) delete item[property];
+ });
+
return item;
};
@@ -800,10 +805,11 @@ var formProps = {input: 'checked', option: 'selected', textarea: 'value'};
Element.implement({
destroy: function(){
- if(! this.getElementsByTagName) return null; //textNode
- var children = clean(this).getElementsByTagName('*');
- Array.each(children, clean);
- Element.dispose(this);
+ if(this.nodeType == 1){
+ var children = clean(this).getElementsByTagName('*');
+ Array.each(children, clean);
+ }
+ Element.dispose(this);
return null;
},
@@ -813,7 +819,6 @@ Element.implement({
},
dispose: function(){
- this._fireEvent = null;
return (this.parentNode) ? this.parentNode.removeChild(this) : this;
},
@@ -954,7 +959,7 @@ Element.Properties.html = {
// fix for IE leak on Element.set('text','')
Element.Properties.text = {
set: function(text){
- Element.prototype.empty.call(this).setProperty('text',text);
+ this.empty().setProperty('text',text);
}
}

0 comments on commit f59f069

Please sign in to comment.
Something went wrong with that request. Please try again.