Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ie leak #2351

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Ie leak #2351

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions Source/Element/Element.js
Original file line number Diff line number Diff line change
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];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to check for existence because otherwise IE throw some nasty error. (Object doesn't support this action)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know why clearAttributes doesn't handle this, or is it because those things begin with $ or _?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://msdn.microsoft.com/en-us/library/ie/ms536350(v=vs.85).aspx
The clearAttributes method clears only persistent HTML attributes. The ID attribute, styles, and script-only properties are not affected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still weird though.. because all other methods are added with Object.append as well, which boils down to simply element.set = function.... So why do you have to delete _fireEvent manually, but not any other method..

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Object doesn't support htis action" is still thrown at "delete item[property]" in IE8.

});

return item;
};

Expand All @@ -800,14 +805,16 @@ var formProps = {input: 'checked', option: 'selected', textarea: 'value'};
Element.implement({

destroy: function(){
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;
},

empty: function(){
Array.from(this.childNodes).each(Element.dispose);
Array.from(this.childNodes).each(Element.destroy);
return this;
},

Expand Down Expand Up @@ -949,6 +956,13 @@ Element.Properties.html = {

};

// fix for IE leak on Element.set('text','')
Element.Properties.text = {
set: function(text){
this.empty().setProperty('text',text);
}
}

var supportsHTML5Elements, supportsTableInnerHTML, supportsTRInnerHTML;

/*<ltIE9>*/
Expand Down