Closed Bug 538963 Opened 15 years ago Closed 1 month ago

Writability check on rows 128 and 129 in swfobject 2.2 makes subsequent call to document.body.removeChild excruciatingly slow

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
Windows XP
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: deleeuw+bugzilla, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)
Build Identifier: 

On row 128 and 129 in http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js there is a test to see if the DOM is writable. They look like this:

var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
t.parentNode.removeChild(t);

On a totally unrelated code row in another javascript library we have a call like this:

document.body.removeChild(this.tmpImg);

When I comment out the rows in swfobject 2.2 mentioned above the call to removeChild in the totally unrelated code row performs as expected, which means very fast. If I leave the rows intact in swfobject 2.2, the call to removeChild takes ages to complete.

In our application, a map, we draw markers for positions on a map. On each marker being drawed, we ran until now this call to removeChild, so the time it took to complete the drawing of the map grew in a very noticeable way with the more markers we added. I have now rewritten the map application to eliminate the call to removeChild.

I don't know why this happens, but my guess is that because swfobject is running this test very early in the life cycle of the page, before the document is really ready, some caching mechanism in the DOM tree is screwed up, making the subsequent removeChild calls parse the whole tree for the node to remove. But that is only my layman guess.

I have tested this in the latest trunk release of Firefox, not only the latest release of Firefox, and the results are the same.

Reproducible: Always
I initially reported this to the swfobject project on Google code:

http://code.google.com/p/swfobject/issues/detail?id=418
FYI, my report to swfobject project on google code just became "Accepted" (NEW in bugzilla): http://code.google.com/p/swfobject/issues/detail?id=418#c3
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5

Ia this bug still relevant or can it be closed by now?

Flags: needinfo?(deleeuw+bugzilla)
Severity: normal → S3
Status: UNCONFIRMED → RESOLVED
Closed: 1 month ago
Flags: needinfo?(deleeuw+bugzilla)
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.