ArcBees / gwtquery

A jQuery clone for GWT, and much more.
MIT License
85 stars 38 forks source link

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

Open 0x3333 opened 9 years ago

0x3333 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

OK for me