<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Removing HTML Element children with JavaScript</title>
	<atom:link href="http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/</link>
	<description>code = joy</description>
	<lastBuildDate>Thu, 11 Mar 2010 21:22:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: D3c1m4L</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-14115</link>
		<dc:creator>D3c1m4L</dc:creator>
		<pubDate>Tue, 23 Sep 2008 23:49:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-14115</guid>
		<description>Hi,
I am currently tracking memory leak bugs in Internet Explorer for a product.  I wanted to point out that using innerHTML=&quot;&quot; can cause memory leaks and removing children can cause memory leaks if any child elements have event handlers.  Googling these terms should yield enough results to get you started.  Beware of methods that do not take this into account.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I am currently tracking memory leak bugs in Internet Explorer for a product.  I wanted to point out that using innerHTML=&#8221;" can cause memory leaks and removing children can cause memory leaks if any child elements have event handlers.  Googling these terms should yield enough results to get you started.  Beware of methods that do not take this into account.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-12784</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Tue, 22 Jul 2008 15:20:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-12784</guid>
		<description>I am doing this:

var removeChildren = function (node) {
	while (node.hasChildNodes()) {
		node.removeChild(node.firstChild);
	}
};

and firefox keeps telling me:

node.hasChildNodes is not a function</description>
		<content:encoded><![CDATA[<p>I am doing this:</p>
<p>var removeChildren = function (node) {<br />
	while (node.hasChildNodes()) {<br />
		node.removeChild(node.firstChild);<br />
	}<br />
};</p>
<p>and firefox keeps telling me:</p>
<p>node.hasChildNodes is not a function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan Bowling</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-11466</link>
		<dc:creator>Evan Bowling</dc:creator>
		<pubDate>Fri, 14 Mar 2008 17:34:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-11466</guid>
		<description>I just thought you might want to know that I just got an error with the initial testing on the node variable in IE7 and Firefox, but it worked when I removed the following section:

if(node !== undefined &amp;&amp; node !=== null) {
      return;</description>
		<content:encoded><![CDATA[<p>I just thought you might want to know that I just got an error with the initial testing on the node variable in IE7 and Firefox, but it worked when I removed the following section:</p>
<p>if(node !== undefined &amp;&amp; node !=== null) {<br />
      return;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bimal</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-11201</link>
		<dc:creator>Bimal</dc:creator>
		<pubDate>Mon, 18 Feb 2008 09:33:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-11201</guid>
		<description>DOM should work on all: IE, Firefox and Opera. I am using the one!</description>
		<content:encoded><![CDATA[<p>DOM should work on all: IE, Firefox and Opera. I am using the one!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arian</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-9744</link>
		<dc:creator>Arian</dc:creator>
		<pubDate>Fri, 02 Nov 2007 13:35:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-9744</guid>
		<description>Just wondering, for this part ... 
if(node !== undefined &amp;&amp; node !=== null)
...
Dont you want to return nothing if the values are null or undefined, so only proceed if have a valid node? aka
if(node == undefined &amp;&amp; node == null)
return null;
//otherwise do while loop

Anyway in the orig code, &#039;!===&#039; a javascript equality operator?
I know &#039;!==&#039; is strict equality operator, is &#039;!===&#039; a mistake? i guess doesnt matter if that line should be replaced.</description>
		<content:encoded><![CDATA[<p>Just wondering, for this part &#8230;<br />
if(node !== undefined &amp;&amp; node !=== null)<br />
&#8230;<br />
Dont you want to return nothing if the values are null or undefined, so only proceed if have a valid node? aka<br />
if(node == undefined &amp;&amp; node == null)<br />
return null;<br />
//otherwise do while loop</p>
<p>Anyway in the orig code, &#8216;!===&#8217; a javascript equality operator?<br />
I know &#8216;!==&#8217; is strict equality operator, is &#8216;!===&#8217; a mistake? i guess doesnt matter if that line should be replaced.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jerrygarciuh</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-8496</link>
		<dc:creator>jerrygarciuh</dc:creator>
		<pubDate>Tue, 26 Jun 2007 13:09:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-8496</guid>
		<description>Thanks!  This was a big help!</description>
		<content:encoded><![CDATA[<p>Thanks!  This was a big help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: emurhfkq</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-8397</link>
		<dc:creator>emurhfkq</dc:creator>
		<pubDate>Fri, 22 Jun 2007 02:41:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-8397</guid>
		<description>people are stranger</description>
		<content:encoded><![CDATA[<p>people are stranger</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Des Traynor</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-6510</link>
		<dc:creator>Des Traynor</dc:creator>
		<pubDate>Wed, 20 Dec 2006 16:11:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-6510</guid>
		<description>Many thanks for this Mike, worked a treat. 
Des
</description>
		<content:encoded><![CDATA[<p>Many thanks for this Mike, worked a treat.<br />
Des</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-6509</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Mon, 23 Oct 2006 23:35:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-6509</guid>
		<description>If you wanted to check what you are deleting you could use a for-in loop:

for(key in parentNode.childNodes){
  if(parentNode.childNodes[key].nodeName == &#039;IMG&#039;){
    parentNode.removeChild(parentNode.childNodes[key]);
  }
}</description>
		<content:encoded><![CDATA[<p>If you wanted to check what you are deleting you could use a for-in loop:</p>
<p>for(key in parentNode.childNodes){<br />
  if(parentNode.childNodes[key].nodeName == &#8216;IMG&#8217;){<br />
    parentNode.removeChild(parentNode.childNodes[key]);<br />
  }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kari Chase</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-6508</link>
		<dc:creator>Kari Chase</dc:creator>
		<pubDate>Fri, 29 Sep 2006 14:50:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-6508</guid>
		<description>I was successfully able to delete nodes with the removeChild/ while loop as you suggested. 

However, in my case I am adding/removing tr elements as you expand/collapse a tree structure. In firefox it is working perfectly, in IE after items are removed there seems to be blank white space added in there place which pushes all rows below down and looks awkward. Any ideas why IE is doing this?
thanks</description>
		<content:encoded><![CDATA[<p>I was successfully able to delete nodes with the removeChild/ while loop as you suggested. </p>
<p>However, in my case I am adding/removing tr elements as you expand/collapse a tree structure. In firefox it is working perfectly, in IE after items are removed there seems to be blank white space added in there place which pushes all rows below down and looks awkward. Any ideas why IE is doing this?<br />
thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>
