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

html('') should execute empty() #347

Open
0x3333 opened this issue Mar 5, 2015 · 2 comments
Open

html('') should execute empty() #347

0x3333 opened this issue Mar 5, 2015 · 2 comments

Comments

@0x3333
Copy link

0x3333 commented Mar 5, 2015

jQuery when called html with an empty string("") it will try to cleanup the node. Just like calling empty() in GQuery.

I think it should check if the html is a empty string, if yes, should call empty() instead, this way we reduce memory leak, as there is a lot out there that calls html("").

If OK, I can create a PR.

@0x3333
Copy link
Author

0x3333 commented Mar 5, 2015

In jQuery manual of html():

Note: In Internet Explorer up to and including version 9, setting the text content of an HTML element may corrupt the text nodes of its children that are being removed from the document as a result of the operation. If you are keeping references to these DOM elements and need them to be unchanged, use .empty().html( string ) instead of .html(string) so that the elements are removed from the document before the new string is assigned to the element.

@jDramaix
Copy link
Contributor

jDramaix commented Mar 6, 2015

OK for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants