<?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: Anonymous function quick tips</title>
	<atom:link href="http://blog.stchur.com/2007/01/02/anonymous-function-quick-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stchur.com/2007/01/02/anonymous-function-quick-tips/</link>
	<description>web / programming / javascript / css / html</description>
	<lastBuildDate>Thu, 26 Aug 2010 07:14:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: stchur talks /* javascript */ ecmascript &#187; Blog Archive &#187; Clean up after your event listeners</title>
		<link>http://blog.stchur.com/2007/01/02/anonymous-function-quick-tips/comment-page-1/#comment-28</link>
		<dc:creator>stchur talks /* javascript */ ecmascript &#187; Blog Archive &#187; Clean up after your event listeners</dc:creator>
		<pubDate>Thu, 06 Sep 2007 06:01:05 +0000</pubDate>
		<guid isPermaLink="false">http://stchur.com/blog2/2007/01/02/anonymous-function-quick-tips/#comment-28</guid>
		<description>[...] a previous blog entry, I mentioned that it wasn&#039;t possible to remove an event listener if that listener were anonymous, [...]</description>
		<content:encoded><![CDATA[<p>[...] a previous blog entry, I mentioned that it wasn&#039;t possible to remove an event listener if that listener were anonymous, [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sstchur</title>
		<link>http://blog.stchur.com/2007/01/02/anonymous-function-quick-tips/comment-page-1/#comment-29</link>
		<dc:creator>sstchur</dc:creator>
		<pubDate>Fri, 19 Jan 2007 18:43:02 +0000</pubDate>
		<guid isPermaLink="false">http://stchur.com/blog2/2007/01/02/anonymous-function-quick-tips/#comment-29</guid>
		<description>Zeroglif:

That&#039;s interesting.  It looks like Mozilla balks at the syntax of something like:

var fn1 = function fn2() { ... }

IE accepts this, but does not see fn1 as being equal to fn2 and therefore, any attempt to remove the listener by calling .detach(&#039;onclick&#039;, fn2) fails.

Both IE and Mozilla however, are happy with something like this:

var fn1, fn2;
fn1 = fn2 = function() { ... }

In that case, fn1 and fn2 &lt;em&gt;are&lt;/em&gt; equal to each other and the event listener removal should succeed.</description>
		<content:encoded><![CDATA[<p>Zeroglif:</p>
<p>That&#039;s interesting.  It looks like Mozilla balks at the syntax of something like:</p>
<p>var fn1 = function fn2() { &#8230; }</p>
<p>IE accepts this, but does not see fn1 as being equal to fn2 and therefore, any attempt to remove the listener by calling .detach(&#039;onclick&#039;, fn2) fails.</p>
<p>Both IE and Mozilla however, are happy with something like this:</p>
<p>var fn1, fn2;<br />
fn1 = fn2 = function() { &#8230; }</p>
<p>In that case, fn1 and fn2 <em>are</em> equal to each other and the event listener removal should succeed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zeroglif</title>
		<link>http://blog.stchur.com/2007/01/02/anonymous-function-quick-tips/comment-page-1/#comment-30</link>
		<dc:creator>Zeroglif</dc:creator>
		<pubDate>Fri, 19 Jan 2007 10:23:45 +0000</pubDate>
		<guid isPermaLink="false">http://stchur.com/blog2/2007/01/02/anonymous-function-quick-tips/#comment-30</guid>
		<description>You are right, Stephen. Some believe that the anonymous functions are identical (https://bugzilla.mozilla.org/show_bug.cgi?id=303744 resolved invalid bug).

What about IE behaviour when 1 function == 2 different objects (FunctionDeclaration in love with FunctionExpression) ?

   var fn1 = function fn2() { alert(&#039;hey there!&#039;); };
   function att() { myDiv.attachEvent(&#039;onclick&#039;, fn1); }
   function det() { myDiv.detachEvent(&#039;onclick&#039;, fn2); }

p.s. Wonderful blog!</description>
		<content:encoded><![CDATA[<p>You are right, Stephen. Some believe that the anonymous functions are identical (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=303744" rel="nofollow">https://bugzilla.mozilla.org/show_bug.cgi?id=303744</a> resolved invalid bug).</p>
<p>What about IE behaviour when 1 function == 2 different objects (FunctionDeclaration in love with FunctionExpression) ?</p>
<p>   var fn1 = function fn2() { alert(&#039;hey there!&#039;); };<br />
   function att() { myDiv.attachEvent(&#039;onclick&#039;, fn1); }<br />
   function det() { myDiv.detachEvent(&#039;onclick&#039;, fn2); }</p>
<p>p.s. Wonderful blog!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
