<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.7" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: How to refresh listeners in Prototype</title>
	<link>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/</link>
	<description>Team BKWLD</description>
	<pubDate>Mon, 01 Dec 2008 19:55:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.7</generator>

	<item>
		<title>by: kangax</title>
		<link>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/#comment-4514</link>
		<pubDate>Tue, 17 Jun 2008 19:32:51 +0000</pubDate>
		<guid>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/#comment-4514</guid>
					<description>I see your point.
Event delegation is obviously not a silver bullet. 
It could be very well not worth it, but performing a tiny operation on every click usually leads to a better performance (vs. having N event handlers in memory)</description>
		<content:encoded><![CDATA[<p>I see your point.<br />
Event delegation is obviously not a silver bullet.<br />
It could be very well not worth it, but performing a tiny operation on every click usually leads to a better performance (vs. having N event handlers in memory)
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Garrett</title>
		<link>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/#comment-4506</link>
		<pubDate>Mon, 16 Jun 2008 22:30:39 +0000</pubDate>
		<guid>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/#comment-4506</guid>
					<description>Maybe not a memory leak, but just the overall viewpoint of it...listening to every click where its not needed, over listening to double clicks on elements that are needed should be targeted that way. That is were I think the if statements are bloated and not needed.

Let me mention that I changed my double click listener to a simple single for this post.</description>
		<content:encoded><![CDATA[<p>Maybe not a memory leak, but just the overall viewpoint of it&#8230;listening to every click where its not needed, over listening to double clicks on elements that are needed should be targeted that way. That is were I think the if statements are bloated and not needed.</p>
<p>Let me mention that I changed my double click listener to a simple single for this post.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: kangax</title>
		<link>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/#comment-4505</link>
		<pubDate>Mon, 16 Jun 2008 21:52:34 +0000</pubDate>
		<guid>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/#comment-4505</guid>
					<description>I don't see why there would be a leak. There seems to be no circular references created (if you are referring to IE' s bug). I've  been using event delegation for quite some time lately and performance gains are usually pretty noticeable.

- kangax</description>
		<content:encoded><![CDATA[<p>I don&#8217;t see why there would be a leak. There seems to be no circular references created (if you are referring to IE&#8217; s bug). I&#8217;ve  been using event delegation for quite some time lately and performance gains are usually pretty noticeable.</p>
<p>- kangax
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Garrett</title>
		<link>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/#comment-4497</link>
		<pubDate>Mon, 16 Jun 2008 04:34:28 +0000</pubDate>
		<guid>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/#comment-4497</guid>
					<description>Won't there be a memory leak over time, listening to &lt;em&gt;every&lt;/em&gt; click and doing if statements all over? Instead of adding the listener to the actual element?</description>
		<content:encoded><![CDATA[<p>Won&#8217;t there be a memory leak over time, listening to <em>every</em> click and doing if statements all over? Instead of adding the listener to the actual element?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: kangax</title>
		<link>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/#comment-4488</link>
		<pubDate>Sun, 15 Jun 2008 20:17:40 +0000</pubDate>
		<guid>http://team.bkwld.com/2008/06/15/how-to-refresh-listeners-in-prototype/#comment-4488</guid>
					<description>This is actually an overkill.
Event delegation seems more appropriate here.
Try this:

document.observe('click', function(e) {
  var target = e.findElement('tr[rel=file]');
  if(!target) return;
  e.stop();
  // send request, etc.
})

Best,
kangax</description>
		<content:encoded><![CDATA[<p>This is actually an overkill.<br />
Event delegation seems more appropriate here.<br />
Try this:</p>
<p>document.observe(&#8217;click&#8217;, function(e) {<br />
  var target = e.findElement(&#8217;tr[rel=file]&#8217;);<br />
  if(!target) return;<br />
  e.stop();<br />
  // send request, etc.<br />
})</p>
<p>Best,<br />
kangax
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
