Skip to content

Commit

Permalink
Applied the suggestions
Browse files Browse the repository at this point in the history
revert dispose, destroy now filter nodeType, so Element.properties.text
can use empty without throwing errors, delete properties in clean.
  • Loading branch information
kentaromiura committed Apr 13, 2012
1 parent 86611be commit f59f069
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Source/Element/Element.js
Expand Up @@ -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;
};

Expand All @@ -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;
},

Expand All @@ -813,7 +819,6 @@ Element.implement({
},

dispose: function(){
this._fireEvent = null;
return (this.parentNode) ? this.parentNode.removeChild(this) : this;
},

Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit f59f069

Please sign in to comment.