Side navigation
#7023 closed bug (invalid)
Opened September 10, 2010 01:42PM UTC
Closed October 03, 2010 08:04PM UTC
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.
Attachments (0)
Change History (4)
Changed September 10, 2010 02:59PM UTC by comment:1
Changed September 10, 2010 03:13PM UTC by comment:2
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'/>";
Changed September 10, 2010 03:17PM UTC by comment:3
Besides, this, everywhere we have:
div = null;
we need to add:
div.outerHTML = '';
right before it so that the HTML element is also removed.
Changed October 03, 2010 08:04PM UTC by comment:4
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:
We are creating an orphan element on every call. This is unnecessary because these browser features don't change over time.
However, the following is still true:
It also creates orphan elements in IE8.