<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Deleting DOM nodes with Dojo</title>
	<atom:link href="http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/feed/" rel="self" type="application/rss+xml" />
	<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/</link>
	<description>Shane O'Sullivan's technical blog... really ties the room together</description>
	<lastBuildDate>Sat, 14 Nov 2009 22:59:04 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Peter Higgins</title>
		<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/#comment-8757</link>
		<dc:creator>Peter Higgins</dc:creator>
		<pubDate>Sat, 03 Jan 2009 02:15:56 +0000</pubDate>
		<guid isPermaLink="false">http://shaneosullivan.wordpress.com/?p=196#comment-8757</guid>
		<description>while(n.lastChild){ n.removeChild(n.lastChild); } is faster to empty a node. removeChild however doesn&#039;t destroy, just leaves them in limbo. But i&#039;ve been wrong before ...</description>
		<content:encoded><![CDATA[<p>while(n.lastChild){ n.removeChild(n.lastChild); } is faster to empty a node. removeChild however doesn&#8217;t destroy, just leaves them in limbo. But i&#8217;ve been wrong before &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Toone</title>
		<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/#comment-8756</link>
		<dc:creator>Nathan Toone</dc:creator>
		<pubDate>Sat, 03 Jan 2009 00:58:34 +0000</pubDate>
		<guid isPermaLink="false">http://shaneosullivan.wordpress.com/?p=196#comment-8756</guid>
		<description>I want in...

Isn&#039;t there an error in your &quot;original&quot; (non-Dojo) code?

You said:

if (node) {
  node.parentNode.removeChild(node);
}

But it probably should be:

if (node &amp;&amp; node.parentNode) {
  node.parentNode.removeChild(node);
}

:)</description>
		<content:encoded><![CDATA[<p>I want in&#8230;</p>
<p>Isn&#8217;t there an error in your &#8220;original&#8221; (non-Dojo) code?</p>
<p>You said:</p>
<p>if (node) {<br />
  node.parentNode.removeChild(node);<br />
}</p>
<p>But it probably should be:</p>
<p>if (node &amp;&amp; node.parentNode) {<br />
  node.parentNode.removeChild(node);<br />
}</p>
<p> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shane O'Sullivan</title>
		<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/#comment-8755</link>
		<dc:creator>Shane O'Sullivan</dc:creator>
		<pubDate>Sat, 03 Jan 2009 00:57:05 +0000</pubDate>
		<guid isPermaLink="false">http://shaneosullivan.wordpress.com/?p=196#comment-8755</guid>
		<description>Also, dojo._destroyElement does not do a null check, so the code in comments #4 and #5 would break if any of the nodes didn&#039;t exist.  Perhaps the dojo.destroy method in 1.3 will do a null check, but if not, it won&#039;t work either.

I&#039;ve updated the post with a new method of deleting nodes, based on Pete&#039;s information that there is a bug in Dojo that means if searching for &quot;#node1, #node2&quot; and &quot;node1&quot; doesn&#039;t exist, &quot;node2&quot; isn&#039;t found and removed.

The updated code gets around this bug.</description>
		<content:encoded><![CDATA[<p>Also, dojo._destroyElement does not do a null check, so the code in comments #4 and #5 would break if any of the nodes didn&#8217;t exist.  Perhaps the dojo.destroy method in 1.3 will do a null check, but if not, it won&#8217;t work either.</p>
<p>I&#8217;ve updated the post with a new method of deleting nodes, based on Pete&#8217;s information that there is a bug in Dojo that means if searching for &#8220;#node1, #node2&#8243; and &#8220;node1&#8243; doesn&#8217;t exist, &#8220;node2&#8243; isn&#8217;t found and removed.</p>
<p>The updated code gets around this bug.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Higgins</title>
		<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/#comment-8754</link>
		<dc:creator>Peter Higgins</dc:creator>
		<pubDate>Sat, 03 Jan 2009 00:53:22 +0000</pubDate>
		<guid isPermaLink="false">http://shaneosullivan.wordpress.com/?p=196#comment-8754</guid>
		<description>okay, to work around any potential unexpected behavior as a result of #7125 (open as of 1.3):

dojo.forEach(nodesIds, function(sel){ dojo.query(sel).forEach(dojo.destroy); });</description>
		<content:encoded><![CDATA[<p>okay, to work around any potential unexpected behavior as a result of #7125 (open as of 1.3):</p>
<p>dojo.forEach(nodesIds, function(sel){ dojo.query(sel).forEach(dojo.destroy); });</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Higgins</title>
		<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/#comment-8753</link>
		<dc:creator>Peter Higgins</dc:creator>
		<pubDate>Sat, 03 Jan 2009 00:37:22 +0000</pubDate>
		<guid isPermaLink="false">http://shaneosullivan.wordpress.com/?p=196#comment-8753</guid>
		<description>it is a little known fact dojo.destory is an undocumented alias to dojo._destroyElement. Always has been. I win. (/me jokes)</description>
		<content:encoded><![CDATA[<p>it is a little known fact dojo.destory is an undocumented alias to dojo._destroyElement. Always has been. I win. (/me jokes)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shane O'Sullivan</title>
		<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/#comment-8752</link>
		<dc:creator>Shane O'Sullivan</dc:creator>
		<pubDate>Sat, 03 Jan 2009 00:35:46 +0000</pubDate>
		<guid isPermaLink="false">http://shaneosullivan.wordpress.com/?p=196#comment-8752</guid>
		<description>if it weren&#039;t for the error your code would throw, I&#039;d agree :-)

dojo.query(nodeIDs.join(”,”)).forEach(dojo.destroy);

I WIN!! ;-)</description>
		<content:encoded><![CDATA[<p>if it weren&#8217;t for the error your code would throw, I&#8217;d agree <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>dojo.query(nodeIDs.join(”,”)).forEach(dojo.destroy);</p>
<p>I WIN!! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Higgins</title>
		<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/#comment-8751</link>
		<dc:creator>Peter Higgins</dc:creator>
		<pubDate>Sat, 03 Jan 2009 00:33:43 +0000</pubDate>
		<guid isPermaLink="false">http://shaneosullivan.wordpress.com/?p=196#comment-8751</guid>
		<description>okay I win:

dojo.query(nodeIDs.join(&quot;,&quot;)).forEach(dojo.destory);</description>
		<content:encoded><![CDATA[<p>okay I win:</p>
<p>dojo.query(nodeIDs.join(&#8220;,&#8221;)).forEach(dojo.destory);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shane O'Sullivan</title>
		<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/#comment-8750</link>
		<dc:creator>Shane O'Sullivan</dc:creator>
		<pubDate>Sat, 03 Jan 2009 00:32:43 +0000</pubDate>
		<guid isPermaLink="false">http://shaneosullivan.wordpress.com/?p=196#comment-8750</guid>
		<description>or 

dojo.forEach(dojo.query(nodeIDs.join), dojo._destroyElement);</description>
		<content:encoded><![CDATA[<p>or </p>
<p>dojo.forEach(dojo.query(nodeIDs.join), dojo._destroyElement);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shane O'Sullivan</title>
		<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/#comment-8749</link>
		<dc:creator>Shane O'Sullivan</dc:creator>
		<pubDate>Sat, 03 Jan 2009 00:20:34 +0000</pubDate>
		<guid isPermaLink="false">http://shaneosullivan.wordpress.com/?p=196#comment-8749</guid>
		<description>Both good solutions Pete, but my one is a better general purpose solution I think, since as you point out, you can use the full CSS selector syntax.

A combined solution could be:

// v1.2
dojo.query(nodeIDs.join(&quot;,&quot;)).forEach(&quot;dojo._destroyElement(item)&quot;);

// v1.3
dojo.query(nodeIDs.join(&quot;,&quot;)).forEach(&quot;dojo.destroy(item)&quot;);</description>
		<content:encoded><![CDATA[<p>Both good solutions Pete, but my one is a better general purpose solution I think, since as you point out, you can use the full CSS selector syntax.</p>
<p>A combined solution could be:</p>
<p>// v1.2<br />
dojo.query(nodeIDs.join(&#8220;,&#8221;)).forEach(&#8220;dojo._destroyElement(item)&#8221;);</p>
<p>// v1.3<br />
dojo.query(nodeIDs.join(&#8220;,&#8221;)).forEach(&#8220;dojo.destroy(item)&#8221;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Higgins</title>
		<link>http://shaneosullivan.wordpress.com/2009/01/02/deleting-dom-nodes-with-dojo/#comment-8748</link>
		<dc:creator>Peter Higgins</dc:creator>
		<pubDate>Fri, 02 Jan 2009 23:49:02 +0000</pubDate>
		<guid isPermaLink="false">http://shaneosullivan.wordpress.com/?p=196#comment-8748</guid>
		<description>how about:

dojo.forEach([&quot;node1&quot;,&quot;node2&quot;,&quot;node3&quot;], dojo._destroyElement);

or in 1.3:

dojo.forEach([&quot;node1&quot;,&quot;node2&quot;,&quot;node3&quot;], dojo.destroy);

(clearly it won&#039;t work in the class-name-looking scenario though)</description>
		<content:encoded><![CDATA[<p>how about:</p>
<p>dojo.forEach(["node1","node2","node3"], dojo._destroyElement);</p>
<p>or in 1.3:</p>
<p>dojo.forEach(["node1","node2","node3"], dojo.destroy);</p>
<p>(clearly it won&#8217;t work in the class-name-looking scenario though)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
