|
|
|
Worked around this by adding check to determine if the element nodeType is 1 (an element node in the HTML)
(See URL for discussion related to this: http://www.codingforums.com/shothread.php?p=342582 ) Snippit below shows changes done to OL 4.0.6 (and similarly to 4.1.x): [snippit from LzSprite.js] .... LzSprite.prototype.__discardElement = function (element) { ...if (LzSprite.prototype.quirks.ie_leak_prevention) { ......// Used instead of node.removeChild to eliminate 'pseudo-leaks' in IE - see http://outofhanwell.com/ieleak/index.php?title=Fixing_Leaks ......if( element.nodeType == 1 ) // <<< ELEMENT_NODE Only ......{ .........if (element.owner) element.owner = null; .........var garbageBin = document.getElementById('__LZIELeakGarbageBin'); .........if (!garbageBin) { ............garbageBin = document.createElement('DIV'); ............garbageBin.id = '__LZIELeakGarbageBin'; ............garbageBin.style.display = 'none'; ............document.body.appendChild(garbageBin); .........} ......... .........// move the element to the garbage bin .........garbageBin.appendChild(element); .........garbageBin.innerHTML = ''; .........//garbageBin.outerHTML = ''; ......} ...} else { ......if (element.parentNode) element.parentNode.removeChild(element); ...} } [end snippit] After further research, there are 12 node types that could exist and be passed in to discardElement().
Should these also be included in the condition about to prevent memory leaks in IE while also preventing the javascript error 'no such interface' from appearing? For example: ..... if( ( element.nodeType >= 1 ) && ( element.nodeType < 13 ) ) // ensures element is valid node ..... { ..... [ same code as in previous comment] ..... } ..... else ..... { ..... element.innerHTML = ''; ..... element = null; ..... } Author: max
Date: 2008-02-14 20:53:11 -0800 (Thu, 14 Feb 2008) New Revision: 8037 Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js Log: Change 20080214-maxcarlson-9 by maxcarlson@Roboto on 2008-02-14 19:57:57 PST in /Users/maxcarlson/openlaszlo/trunk for http://svn.openlaszlo.org/openlaszlo/trunk Summary: Fix errors on page reloads in IE DHTML New Features: Bugs Fixed: Technical Reviewer: promanik QA Reviewer: a.bargull@intensis.de Doc Reviewer: (pending) Documentation: Release Notes: Details: Check div.nodeType in discardElement() Tests: See Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js =================================================================== --- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2008-02-15 04:00:29 UTC (rev 8036) +++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2008-02-15 04:53:11 UTC (rev 8037) @@ -1527,19 +1527,22 @@ if (LzSprite.prototype.quirks.ie_leak_prevention) { // Used instead of node.removeChild to eliminate 'pseudo-leaks' in IE - see http://outofhanwell.com/ieleak/index.php?title=Fixing_Leaks //alert('__discardElement' + element); - if (element.owner) element.owner = null; - var garbageBin = document.getElementById('__LZIELeakGarbageBin'); - if (!garbageBin) { - garbageBin = document.createElement('DIV'); - garbageBin.id = '__LZIELeakGarbageBin'; - garbageBin.style.display = 'none'; - document.body.appendChild(garbageBin); + if( ( element.nodeType >= 1 ) && ( element.nodeType < 13 ) ) { + // ensures element is valid node + if (element.owner) element.owner = null; + var garbageBin = document.getElementById('__LZIELeakGarbageBin'); + if (!garbageBin) { + garbageBin = document.createElement('DIV'); + garbageBin.id = '__LZIELeakGarbageBin'; + garbageBin.style.display = 'none'; + document.body.appendChild(garbageBin); + } + + // move the element to the garbage bin + garbageBin.appendChild(element); + garbageBin.innerHTML = ''; + //garbageBin.outerHTML = ''; } - - // move the element to the garbage bin - garbageBin.appendChild(element); - garbageBin.innerHTML = ''; - //garbageBin.outerHTML = ''; } else { if (element.parentNode) element.parentNode.removeChild(element); } _______________________________________________ Laszlo-checkins mailing list Laszlo-checkins@openlaszlo.org http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins |
||||||||||||||||||||||||||||||||||||||||||||||||||||
The function where the problem occurs is:
...... __cleanUpForIE()
...... .... LzSprite.prototype.__discardElement()
...... .... ...
...... .... $2.appendChild( $1 )
$2:
..... id: __LZIELeakGarbageBin
..... innerHTML: "Yq_qy"
$1:
...... innerHTML: '' (two single quotes)