<?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>Fri, 02 Dec 2011 01:36:37 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Elad Karako</title>
		<link>http://www.mikechambers.com/blog/2006/01/24/removing-html-element-children-with-javascript/comment-page-1/#comment-22537</link>
		<dc:creator>Elad Karako</dc:creator>
		<pubDate>Tue, 25 May 2010 11:15:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=939#comment-22537</guid>
		<description>Here is the Correct Way To Remove An Object.
For Example, Let Us Say You Want To Remove All iframe Objects From The Page Using A Small (and fast) Script:

(function () {
    window.addEventListener(&quot;load&quot;, function () {
        for (var a = document.getElementsByTagName(&quot;iframe&quot;), b = 0; b &lt; a.length; b++) {
            for (; a.hasChildNodes();) a.removeChild(a.firstChild);
            a.parentNode.removeChild(a)
        }
    }, false)
})();

Note #1: Don&#039;t Use &quot;While Loops&quot;.
Note #2: You Can Loose The Inner Loop If You Just Need to Remove The &quot;iframe Parent&quot;.</description>
		<content:encoded><![CDATA[<p>Here is the Correct Way To Remove An Object.<br />
For Example, Let Us Say You Want To Remove All iframe Objects From The Page Using A Small (and fast) Script:</p>
<p>(function () {<br />
    window.addEventListener(&#8220;load&#8221;, function () {<br />
        for (var a = document.getElementsByTagName(&#8220;iframe&#8221;), b = 0; b &lt; a.length; b++) {<br />
            for (; a.hasChildNodes();) a.removeChild(a.firstChild);<br />
            a.parentNode.removeChild(a)<br />
        }<br />
    }, false)<br />
})();</p>
<p>Note #1: Don&#039;t Use &quot;While Loops&quot;.<br />
Note #2: You Can Loose The Inner Loop If You Just Need to Remove The &quot;iframe Parent&quot;.</p>
]]></content:encoded>
	</item>
	<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>
</channel>
</rss>

