<?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: The Ultimate addEvent(..) function</title>
	<atom:link href="http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/</link>
	<description>If you don&#039;t expect too much from me, you might not be let down.</description>
	<lastBuildDate>Thu, 26 Jan 2012 08:23:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: sstchur</title>
		<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/comment-page-1/#comment-111105</link>
		<dc:creator>sstchur</dc:creator>
		<pubDate>Wed, 13 Apr 2011 17:10:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/#comment-111105</guid>
		<description>Hi Bettina,

Yes, the issue would be that you&#039;re using an anonymous function defined on the fly.  It&#039;s important to realize that any function created this way is always unique, so every time you make a call, the Javascript interpreter sees it as a new function being wired up.

The solution is simply to not use anonymous functions.

function formElementBlur(e)
{
   updateField(this, this.value);
}

xb.addEvent(allFormElements[x], &#039;blur&#039;, formElementBlur);

Hope this helps!</description>
		<content:encoded><![CDATA[<p>Hi Bettina,</p>
<p>Yes, the issue would be that you&#039;re using an anonymous function defined on the fly.  It&#039;s important to realize that any function created this way is always unique, so every time you make a call, the Javascript interpreter sees it as a new function being wired up.</p>
<p>The solution is simply to not use anonymous functions.</p>
<p>function formElementBlur(e)<br />
{<br />
   updateField(this, this.value);<br />
}</p>
<p>xb.addEvent(allFormElements[x], &#039;blur&#039;, formElementBlur);</p>
<p>Hope this helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bettina</title>
		<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/comment-page-1/#comment-111100</link>
		<dc:creator>Bettina</dc:creator>
		<pubDate>Wed, 13 Apr 2011 16:35:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/#comment-111100</guid>
		<description>Sorry, forgot the last closing bracket.  I&#039;m using this:
xb.addEvent(allFormElements[x], &quot;blur&quot;, function () { updateField(this, this.value) });</description>
		<content:encoded><![CDATA[<p>Sorry, forgot the last closing bracket.  I&#039;m using this:<br />
xb.addEvent(allFormElements[x], &#034;blur&#034;, function () { updateField(this, this.value) });</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bettina</title>
		<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/comment-page-1/#comment-111099</link>
		<dc:creator>Bettina</dc:creator>
		<pubDate>Wed, 13 Apr 2011 16:33:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/#comment-111099</guid>
		<description>First of all, I want to thank you for this code, it&#039;s helped me a lot already. I&#039;m having an issue however.  I&#039;m working with IE8 and I want to attach an event with a function to an element.  Since the function requires two parameters, I&#039;m doing the following: xb.addEvent(allFormElements[x], &quot;blur&quot;, function () {updateField(this, this.value)};
But then your script fails to recognize if the function has already been attached to the element and adds it again, thus causing my update function to be called more than once.  I&#039;m guessing since I&#039;m using anonymous functions.  Do you have a solution?</description>
		<content:encoded><![CDATA[<p>First of all, I want to thank you for this code, it&#039;s helped me a lot already. I&#039;m having an issue however.  I&#039;m working with IE8 and I want to attach an event with a function to an element.  Since the function requires two parameters, I&#039;m doing the following: xb.addEvent(allFormElements[x], &#034;blur&#034;, function () {updateField(this, this.value)};<br />
But then your script fails to recognize if the function has already been attached to the element and adds it again, thus causing my update function to be called more than once.  I&#039;m guessing since I&#039;m using anonymous functions.  Do you have a solution?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sstchur</title>
		<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/comment-page-1/#comment-81891</link>
		<dc:creator>sstchur</dc:creator>
		<pubDate>Tue, 28 Sep 2010 22:50:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/#comment-81891</guid>
		<description>Thanks!  Glad you&#039;re finding it useful.

We&#039;ve been testing out IE9 around here lately and I haven&#039;t had any issues as of yet.  On my team, we&#039;re using the version of addEvent that is in Gimme, but it is more or less identical to the UAE function.  But I&#039;m glad you brought it up -- I might have a few tweaks or bug fixes I&#039;ve made in the Gimme version that I should probably port over to UAE.  I&#039;ll make it a mental TODO.

If you run into any IE9 problems, let me know.  If I can&#039;t fix it, I&#039;ll ping the IE team.</description>
		<content:encoded><![CDATA[<p>Thanks!  Glad you&#039;re finding it useful.</p>
<p>We&#039;ve been testing out IE9 around here lately and I haven&#039;t had any issues as of yet.  On my team, we&#039;re using the version of addEvent that is in Gimme, but it is more or less identical to the UAE function.  But I&#039;m glad you brought it up &#8212; I might have a few tweaks or bug fixes I&#039;ve made in the Gimme version that I should probably port over to UAE.  I&#039;ll make it a mental TODO.</p>
<p>If you run into any IE9 problems, let me know.  If I can&#039;t fix it, I&#039;ll ping the IE team.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: HB</title>
		<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/comment-page-1/#comment-81888</link>
		<dc:creator>HB</dc:creator>
		<pubDate>Tue, 28 Sep 2010 22:17:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/#comment-81888</guid>
		<description>I still use this in some projects today, it&#039;s really straightforward and reliable, and the built-in mouseenter/mouseleave is great. Have you done any testing in IE9, and/or do you expect to need to make any changes? From the looks of things it should probably follow the w3c flow and have no problems, but figured I&#039;d ask if you knew for sure.</description>
		<content:encoded><![CDATA[<p>I still use this in some projects today, it&#039;s really straightforward and reliable, and the built-in mouseenter/mouseleave is great. Have you done any testing in IE9, and/or do you expect to need to make any changes? From the looks of things it should probably follow the w3c flow and have no problems, but figured I&#039;d ask if you knew for sure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Carver</title>
		<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/comment-page-1/#comment-35079</link>
		<dc:creator>Bob Carver</dc:creator>
		<pubDate>Thu, 11 Mar 2010 00:46:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/#comment-35079</guid>
		<description>I discovered an interesting manifestation, that&#039;s only an issue in IE, when cloning nodes. It was necesssary to remove all event handlers before doing the clone, and then restoring those event handlers after the clone operation (and subsequent insertBefore elsewhere). If this was not done, for example, the mouseenter event was triggered by both the original node as well as the new node, even though the id of the new node was modified to be unique. There was no problem in FF or Chrome, just IE. It took quite a bit of time to figure this one out...</description>
		<content:encoded><![CDATA[<p>I discovered an interesting manifestation, that&#039;s only an issue in IE, when cloning nodes. It was necesssary to remove all event handlers before doing the clone, and then restoring those event handlers after the clone operation (and subsequent insertBefore elsewhere). If this was not done, for example, the mouseenter event was triggered by both the original node as well as the new node, even though the id of the new node was modified to be unique. There was no problem in FF or Chrome, just IE. It took quite a bit of time to figure this one out&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sstchur</title>
		<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/comment-page-1/#comment-7601</link>
		<dc:creator>sstchur</dc:creator>
		<pubDate>Wed, 17 Dec 2008 20:23:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/#comment-7601</guid>
		<description>@Mathias:

Ok, this is back online now.  Sorry for the inconvenience.</description>
		<content:encoded><![CDATA[<p>@Mathias:</p>
<p>Ok, this is back online now.  Sorry for the inconvenience.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sstchur</title>
		<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/comment-page-1/#comment-7583</link>
		<dc:creator>sstchur</dc:creator>
		<pubDate>Wed, 17 Dec 2008 15:48:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/#comment-7583</guid>
		<description>@Mathias:

Shoot!  I&#039;m sorry.  I know what happened.  I upgraded WordPress and I accidentally deleted my blogcode directory.

Let me see if I can dig up a backup and get the files back in place.

In the meantime, certainly feel free to check out the Gimme Library.  It has a lot more functionality than just the addEvent function.</description>
		<content:encoded><![CDATA[<p>@Mathias:</p>
<p>Shoot!  I&#039;m sorry.  I know what happened.  I upgraded WordPress and I accidentally deleted my blogcode directory.</p>
<p>Let me see if I can dig up a backup and get the files back in place.</p>
<p>In the meantime, certainly feel free to check out the Gimme Library.  It has a lot more functionality than just the addEvent function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathias</title>
		<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/comment-page-1/#comment-7575</link>
		<dc:creator>Mathias</dc:creator>
		<pubDate>Wed, 17 Dec 2008 14:01:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/#comment-7575</guid>
		<description>Have you deleted the zip?
When I click on the link it just gives me an error page saying the page wasn&#039;t found..

Should I just get the gimme lib instead?</description>
		<content:encoded><![CDATA[<p>Have you deleted the zip?<br />
When I click on the link it just gives me an error page saying the page wasn&#039;t found..</p>
<p>Should I just get the gimme lib instead?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sstchur</title>
		<link>http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/comment-page-1/#comment-3814</link>
		<dc:creator>sstchur</dc:creator>
		<pubDate>Sat, 04 Oct 2008 04:24:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stchur.com/2008/09/25/the-ultimate-addevent-function/#comment-3814</guid>
		<description>Jamie,

&lt;p&gt;Did you copy/paste or download the zip?  I just downloaded the zip, included the .js file using a &lt;script&gt; tag, and tested the function in Firefox 3.0.3, and it worked just fine.&lt;/p&gt;

&lt;p&gt;I did not modify a single character in the .js file, and it worked perfectly for me -- no errors at all.  The (function(){...})() is perfectly valid and did not cause any errors.  And the event I hooked up worked properly as well.&lt;/p&gt;

&lt;p&gt;I&#039;d suggest maybe trying the version in the zip, if you haven&#039;t already.  I did mention in the post, that in the interest of keeping the blog entry a little shorter, copying and pasting will not work as an &quot;out of the box&quot; solution.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Jamie,</p>
<p>Did you copy/paste or download the zip?  I just downloaded the zip, included the .js file using a &lt;script&gt; tag, and tested the function in Firefox 3.0.3, and it worked just fine.</p>
<p>I did not modify a single character in the .js file, and it worked perfectly for me &#8212; no errors at all.  The (function(){&#8230;})() is perfectly valid and did not cause any errors.  And the event I hooked up worked properly as well.</p>
<p>I&#039;d suggest maybe trying the version in the zip, if you haven&#039;t already.  I did mention in the post, that in the interest of keeping the blog entry a little shorter, copying and pasting will not work as an &#034;out of the box&#034; solution.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

