Skip to main content

Bug Tracker

Side navigation

#14045 closed bug (migrated)

Opened June 20, 2013 08:54AM UTC

Closed October 21, 2014 12:12AM UTC

IE8: empty() leaks children if they were attached via DocumentFragment

Reported by: Owned by:
Priority: low Milestone:
Component: manipulation Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

empty() does not cleanly remove the children, which were attached via a DocumentFragment. The issue is a bug in IE8's (and below) Node.removeChild().

Running this fiddle in Sieve demonstrates the problem (IE8/sieve can't run jsfiddle, you have to create a local html):

Minimal test case:

  • press the button
  • see that in Sieve the 10 elements are still in memory ('orphaned') althought the container was emptied:

The issue is resolved by using Node.removeNode(true). You can test the effect of removeNode in the fiddle by setting USE_DESTORY=true, reloading and pressing the button again (the elements no longer leak).

As this test case demonstrates, the issue can be resolved by using Node.removeNode(false) in IE8 instead of Node.removeChild; for example here:

Additionally, the dojo source documents this IE8- bug right here:

Attachments (0)
Change History (5)

Changed June 20, 2013 08:57AM UTC by anonymous comment:1

fiddle updated:

(i had a line too much in it from testing)

Changed June 23, 2013 04:40PM UTC by dmethvin comment:2

component: unfiledmanipulation
priority: undecidedlow
status: newopen


We don't support document fragments as API inputs but it seems like this would occur for internal uses as well.

Changed June 25, 2013 09:24AM UTC by comment:3

I always assumed that's supported but a closer look at the API proves me wrong.

This seems to be a general IE bug and not at all related to jquery. I was able to reproduce the leaking behavior with an even simpler case:

for (var i = 0; i<10; i++) {
	var frag = document.createDocumentFragment();
	var div = document.createElement('div');
	frag = null;

the leak is closed if I explicitly call removeNode on the fragments children (after each iteration):

while (c = frag.lastChild) {

Changed December 06, 2013 05:25PM UTC by timmywil comment:4

#14214 is a duplicate of this ticket.

Changed October 21, 2014 12:12AM UTC by m_gol comment:5

resolution: → migrated
status: openclosed