Opened 12 years ago
Closed 12 years ago
#7023 closed bug (invalid)
jQuery.support leaves Orphan nodes around
Reported by: | chancharles | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.3 |
Component: | support | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
For these two support features:
optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null,
We are creating an orphan element on every call. This is unnecessary because these browser features don't change over time. It also creates orphan elements in IE8.
A better approach would be to initialize them to "false" and then set their values immediately after the jQuery.support initialization block.
Change History (4)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
I think I figured out how to rid some of the orphan element..
You can keep the existing code in the jQuery.support.
All you need to do is add:
div.innerHTML =
right before (line 929):
div = document.createElement("div"); div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
comment:3 Changed 12 years ago by
Besides, this, everywhere we have:
div = null;
we need to add:
div.outerHTML = ;
right before it so that the HTML element is also removed.
comment:4 Changed 12 years ago by
Priority: | → undecided |
---|---|
Resolution: | → invalid |
Status: | new → closed |
The div should be garbage-collected since it doesn't have event handlers or Javascript objects attached to it. Can you reopen with some further explanation and explain the tools you're using to determine that the div is never reaped?
Sorry, I must be on drugs today. The following statement is wrong:
However, the following is still true: