Bug Tracker

Opened 9 years ago

Closed 9 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 9 years ago by chancharles

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.

comment:2 Changed 9 years ago by chancharles

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 9 years ago by chancharles

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 9 years ago by dmethvin

Priority: undecided
Resolution: invalid
Status: newclosed

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?

Note: See TracTickets for help on using tickets.