<?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: Implementing Event Latency in JavaScript</title>
	<atom:link href="http://www.sitepoint.com/blogs/2009/06/18/javascript-event-latency/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2009/06/18/javascript-event-latency/</link>
	<description>News, opinion, and fresh thinking for web developers and designers. The official podcast of sitepoint.com.</description>
	<lastBuildDate>Mon, 23 Nov 2009 00:48:44 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: omnicity</title>
		<link>http://www.sitepoint.com/blogs/2009/06/18/javascript-event-latency/comment-page-1/#comment-927683</link>
		<dc:creator>omnicity</dc:creator>
		<pubDate>Sat, 27 Jun 2009 12:06:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=9856#comment-927683</guid>
		<description>How about doing a re-write then, using a real example?

As it stands, the article doesn&#039;t really match the title.</description>
		<content:encoded><![CDATA[<p>How about doing a re-write then, using a real example?</p>
<p>As it stands, the article doesn&#8217;t really match the title.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Derekp</title>
		<link>http://www.sitepoint.com/blogs/2009/06/18/javascript-event-latency/comment-page-1/#comment-927564</link>
		<dc:creator>Derekp</dc:creator>
		<pubDate>Thu, 25 Jun 2009 18:46:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=9856#comment-927564</guid>
		<description>I think i&#039;ve seen this somewhere before…but it&#039;s not bad at all</description>
		<content:encoded><![CDATA[<p>I think i&#8217;ve seen this somewhere before…but it&#8217;s not bad at all</p>]]></content:encoded>
	</item>
	<item>
		<title>By: brothercake</title>
		<link>http://www.sitepoint.com/blogs/2009/06/18/javascript-event-latency/comment-page-1/#comment-927133</link>
		<dc:creator>brothercake</dc:creator>
		<pubDate>Thu, 18 Jun 2009 23:21:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=9856#comment-927133</guid>
		<description>What did you intend it as a solution for?</description>
		<content:encoded><![CDATA[<p>What did you intend it as a solution for?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Buckler</title>
		<link>http://www.sitepoint.com/blogs/2009/06/18/javascript-event-latency/comment-page-1/#comment-927131</link>
		<dc:creator>Craig Buckler</dc:creator>
		<pubDate>Thu, 18 Jun 2009 19:24:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=9856#comment-927131</guid>
		<description>Thanks for the feedback. The code above was a quick example showing how event latency can be implemented with setTimeout. It&#039;s certainly not a solution for cross-firing issues, so apologies if that&#039;s not clear enough.</description>
		<content:encoded><![CDATA[<p>Thanks for the feedback. The code above was a quick example showing how event latency can be implemented with setTimeout. It&#8217;s certainly not a solution for cross-firing issues, so apologies if that&#8217;s not clear enough.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: brothercake</title>
		<link>http://www.sitepoint.com/blogs/2009/06/18/javascript-event-latency/comment-page-1/#comment-927126</link>
		<dc:creator>brothercake</dc:creator>
		<pubDate>Thu, 18 Jun 2009 16:28:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=9856#comment-927126</guid>
		<description>Sorry, here&#039;s that method again (free of typos this time!)

&lt;code&gt;object.contains = function(node)
{
&#160;&#160;if(node == this) { return true; }
&#160;&#160;if(node == null) { return false; }
&#160;&#160;else { return this.contains(node.parentNode); }
};&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Sorry, here&#8217;s that method again (free of typos this time!)</p>
<code>object.contains = function(node)
{
&nbsp;&nbsp;if(node == this) { return true; }
&nbsp;&nbsp;if(node == null) { return false; }
&nbsp;&nbsp;else { return this.contains(node.parentNode); }
};</code>]]></content:encoded>
	</item>
	<item>
		<title>By: brothercake</title>
		<link>http://www.sitepoint.com/blogs/2009/06/18/javascript-event-latency/comment-page-1/#comment-927125</link>
		<dc:creator>brothercake</dc:creator>
		<pubDate>Thu, 18 Jun 2009 16:26:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=9856#comment-927125</guid>
		<description>There&#039;s a couple of things wrong with this.

Firstly - the issue you mentioned of mouseout and mouseover events cross-firing between the two elements is far better fixed by discriminating the event target using a contains() method:

object.contains = function(node)
{
    if(node == this) { return true; }
    if(nodes == null) { return false; }
    else { return this.contains(node.parentNode); }
}

Using a timer to fix this issue is really just pasting over it, and not dealing with it at all - if you rely on such a solution, I guarantee it will come back and bite you later on.

Secondly - you say that a timer is useful for dropdown menus, but it&#039;s only useful if it&#039;s discriminated in some way. You need to ensure that the event is still inside the target element at the end of the timer, otherwise all you&#039;ve done is introduce a useless pause.</description>
		<content:encoded><![CDATA[<p>There&#8217;s a couple of things wrong with this.</p>
<p>Firstly &#8211; the issue you mentioned of mouseout and mouseover events cross-firing between the two elements is far better fixed by discriminating the event target using a contains() method:</p>
<p>object.contains = function(node)<br />
{<br />
    if(node == this) { return true; }<br />
    if(nodes == null) { return false; }<br />
    else { return this.contains(node.parentNode); }<br />
}</p>
<p>Using a timer to fix this issue is really just pasting over it, and not dealing with it at all &#8211; if you rely on such a solution, I guarantee it will come back and bite you later on.</p>
<p>Secondly &#8211; you say that a timer is useful for dropdown menus, but it&#8217;s only useful if it&#8217;s discriminated in some way. You need to ensure that the event is still inside the target element at the end of the timer, otherwise all you&#8217;ve done is introduce a useless pause.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Grossman</title>
		<link>http://www.sitepoint.com/blogs/2009/06/18/javascript-event-latency/comment-page-1/#comment-927103</link>
		<dc:creator>Dan Grossman</dc:creator>
		<pubDate>Thu, 18 Jun 2009 00:21:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=9856#comment-927103</guid>
		<description>Good topic to cover, thanks. I recently implemented a solution like this for some dropdown menus. Users sometimes have trouble keeping the mouse pointer over the menu elements while moving it to choose one, and you don&#039;t want the menu to collapse itself immediately when the pointer leaves for just a fraction of a second. So the menu is on a delay similar to your code that watches for the mouse returning to the menu within X milliseconds to cancel the collapse.</description>
		<content:encoded><![CDATA[<p>Good topic to cover, thanks. I recently implemented a solution like this for some dropdown menus. Users sometimes have trouble keeping the mouse pointer over the menu elements while moving it to choose one, and you don&#8217;t want the menu to collapse itself immediately when the pointer leaves for just a fraction of a second. So the menu is on a delay similar to your code that watches for the mouse returning to the menu within X milliseconds to cancel the collapse.</p>]]></content:encoded>
	</item>
</channel>
</rss>
