<?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: Event Delegation for MooTools</title>
	<atom:link href="http://www.clientcide.com/code-releases/event-delegation-for-mootools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.clientcide.com/code-releases/event-delegation-for-mootools/</link>
	<description>Making stuff work on the other side of the request.</description>
	<lastBuildDate>Thu, 12 Jan 2012 20:00:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: MooTools Event Delegation &#124; Castup</title>
		<link>http://www.clientcide.com/code-releases/event-delegation-for-mootools/comment-page-1/#comment-31667</link>
		<dc:creator>MooTools Event Delegation &#124; Castup</dc:creator>
		<pubDate>Tue, 30 Dec 2008 07:37:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.clientcide.com/?p=643#comment-31667</guid>
		<description>[...] this functionality into MooTools 1.3 but I assume they will. I strongly suggest MooTools developers read Aaron&#8217;s article at Clientcide. I also recommend this article for jQuery users as John Resig recently boasted of this addition to [...]</description>
		<content:encoded><![CDATA[<p>[...] this functionality into MooTools 1.3 but I assume they will. I strongly suggest MooTools developers read Aaron&#8217;s article at Clientcide. I also recommend this article for jQuery users as John Resig recently boasted of this addition to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron N.</title>
		<link>http://www.clientcide.com/code-releases/event-delegation-for-mootools/comment-page-1/#comment-31656</link>
		<dc:creator>Aaron N.</dc:creator>
		<pubDate>Wed, 24 Dec 2008 02:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.clientcide.com/?p=643#comment-31656</guid>
		<description>That&#039;s not really accurate Sean. If you call a method on what $$ returns (an array) it basically handles the looping for you. So your example above in your comment is the same thing as my first example. You&#039;re still looping over all the anchors in the document and adding an event to each. Further, if you were to chain this you would actually loop through it more than once. I.e. this is &lt;i&gt;bad&lt;/i&gt;:

&lt;code&gt;$$(&#039;a&#039;).addEvent(...).setStyle(...)&lt;/code&gt;

The above code would loop through all the links twice.

Further, this doesn&#039;t accomplish the same goals. You aren&#039;t delegating the event to a parent but rather attaching an event to each item, which is precisely what delegation helps you avoid.</description>
		<content:encoded><![CDATA[<p>That&#8217;s not really accurate Sean. If you call a method on what $$ returns (an array) it basically handles the looping for you. So your example above in your comment is the same thing as my first example. You&#8217;re still looping over all the anchors in the document and adding an event to each. Further, if you were to chain this you would actually loop through it more than once. I.e. this is <i>bad</i>:</p>
<p><code>$$('a').addEvent(...).setStyle(...)</code></p>
<p>The above code would loop through all the links twice.</p>
<p>Further, this doesn&#8217;t accomplish the same goals. You aren&#8217;t delegating the event to a parent but rather attaching an event to each item, which is precisely what delegation helps you avoid.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean McArthur</title>
		<link>http://www.clientcide.com/code-releases/event-delegation-for-mootools/comment-page-1/#comment-31655</link>
		<dc:creator>Sean McArthur</dc:creator>
		<pubDate>Wed, 24 Dec 2008 01:43:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.clientcide.com/?p=643#comment-31655</guid>
		<description>Just wanted to point out that Mootools kind of does this for you.  Or well, it doesn&#039;t delegate probably in the same way you do.  I haven&#039;t popped the hood yet.

But you&#039;re example can be done without looping through each element:

&lt;code&gt;$$(&#039;a&#039;).addEvent(&#039;click&#039;, function() {
      console.log(&#039;poop&#039;);
});&lt;/code&gt;

The addEvent function also works for element collections and will add the event to every element in the collection.</description>
		<content:encoded><![CDATA[<p>Just wanted to point out that Mootools kind of does this for you.  Or well, it doesn&#8217;t delegate probably in the same way you do.  I haven&#8217;t popped the hood yet.</p>
<p>But you&#8217;re example can be done without looping through each element:</p>
<p><code>$$('a').addEvent('click', function() {<br />
      console.log('poop');<br />
});</code></p>
<p>The addEvent function also works for element collections and will add the event to every element in the collection.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

