<?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: Configuring UI widgets and interactions with .live() and .delegate()</title>
	<atom:link href="http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/feed/" rel="self" type="application/rss+xml" />
	<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/</link>
	<description>Effective, High-Perfomance jQuery for Teams</description>
	<lastBuildDate>Mon, 10 Oct 2011 14:30:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: belugabob</title>
		<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/#comment-331</link>
		<dc:creator>belugabob</dc:creator>
		<pubDate>Mon, 10 Oct 2011 14:30:53 +0000</pubDate>
		<guid isPermaLink="false">http://ejq.dev.appendto.com/?p=49#comment-331</guid>
		<description>I feel that Nathan meant to say that you should use...&lt;br&gt;$(&#039;.myDraggableClass&#039;).live(&#039;mouseenter&#039;,function(){    $(this).draggable({        // configure draggable here      });});&lt;br&gt;$(&#039;.myDraggableClass&#039;).live(&#039;mouseleave&#039;,function(){    $(this).draggable(&quot;destroy&quot;);});&lt;br&gt;&lt;br&gt;...as what you want to happen is for the draggable handler to be removed from the element when the mouse leaves it. This prevents the accumulation of multiple elements (potentially, lots) that are marked as draggable - performance degrades when too many elements are draggable.&lt;br&gt;&lt;br&gt;There are other issues involved with this, due to the fact that fast drags can cause the mouse to leave the element halfway through a drag operation. I&#039;m working on a solution to this, as I have an application with lots of drag targets, and having them all draggable at once really affect performance. I&#039;ll consider posting my solution as and when I get it working.</description>
		<content:encoded><![CDATA[<p>I feel that Nathan meant to say that you should use&#8230;<br />$(&#39;.myDraggableClass&#39;).live(&#39;mouseenter&#39;,function(){    $(this).draggable({        // configure draggable here      });});<br />$(&#39;.myDraggableClass&#39;).live(&#39;mouseleave&#39;,function(){    $(this).draggable(&#8220;destroy&#8221;);});</p>
<p>&#8230;as what you want to happen is for the draggable handler to be removed from the element when the mouse leaves it. This prevents the accumulation of multiple elements (potentially, lots) that are marked as draggable &#8211; performance degrades when too many elements are draggable.</p>
<p>There are other issues involved with this, due to the fact that fast drags can cause the mouse to leave the element halfway through a drag operation. I&#39;m working on a solution to this, as I have an application with lots of drag targets, and having them all draggable at once really affect performance. I&#39;ll consider posting my solution as and when I get it working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Wirick</title>
		<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/#comment-304</link>
		<dc:creator>Andrew Wirick</dc:creator>
		<pubDate>Tue, 10 May 2011 22:04:31 +0000</pubDate>
		<guid isPermaLink="false">http://ejq.dev.appendto.com/?p=49#comment-304</guid>
		<description>Hi Patrick,

In your situation I would probably initialize the droppable targets on drag start. There is a &quot;dragstart&quot; event hook for draggables - anything that may be a drop target could be initialized in there.

Check out - http://jqueryui.com/demos/draggable/#event-start</description>
		<content:encoded><![CDATA[<p>Hi Patrick,</p>
<p>In your situation I would probably initialize the droppable targets on drag start. There is a &#8220;dragstart&#8221; event hook for draggables &#8211; anything that may be a drop target could be initialized in there.</p>
<p>Check out &#8211; <a href="http://jqueryui.com/demos/draggable/#event-start" rel="nofollow">http://jqueryui.com/demos/draggable/#event-start</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/#comment-303</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Tue, 10 May 2011 19:12:19 +0000</pubDate>
		<guid isPermaLink="false">http://ejq.dev.appendto.com/?p=49#comment-303</guid>
		<description>love the idea, trying to use it for droppable and running into some problems, however. 

Works as expected when you mouseover any element, problem is you have to do so before you can drag an element on to it.

If the mouse enters the droppable element for the first time while dragging a draggable element, it doesn&#039;t seem to trigger the event (or maybe if does after you let go of the draggable, but it&#039;s too late at that point). Any ideas?</description>
		<content:encoded><![CDATA[<p>love the idea, trying to use it for droppable and running into some problems, however. </p>
<p>Works as expected when you mouseover any element, problem is you have to do so before you can drag an element on to it.</p>
<p>If the mouse enters the droppable element for the first time while dragging a draggable element, it doesn&#8217;t seem to trigger the event (or maybe if does after you let go of the draggable, but it&#8217;s too late at that point). Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aglemann</title>
		<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/#comment-295</link>
		<dc:creator>aglemann</dc:creator>
		<pubDate>Wed, 02 Mar 2011 20:42:16 +0000</pubDate>
		<guid isPermaLink="false">http://ejq.dev.appendto.com/?p=49#comment-295</guid>
		<description>I like your approach! Especially for existing UI widgets. I took a different approach for crafting widgets to act like delegates:&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://github.com/aglemann/jquery-delegate&quot; rel=&quot;nofollow&quot;&gt;https://github.com/aglemann/jq...&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>I like your approach! Especially for existing UI widgets. I took a different approach for crafting widgets to act like delegates:</p>
<p><a href="https://github.com/aglemann/jquery-delegate" rel="nofollow">https://github.com/aglemann/jq&#8230;</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hm2k</title>
		<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/#comment-285</link>
		<dc:creator>hm2k</dc:creator>
		<pubDate>Mon, 31 Jan 2011 05:17:35 +0000</pubDate>
		<guid isPermaLink="false">http://ejq.dev.appendto.com/?p=49#comment-285</guid>
		<description>I had a go at this but with autocomplete and it didn&#039;t seem to work...&lt;br&gt;&lt;br&gt;Here&#039;s my attempt: &lt;a href=&quot;http://jsfiddle.net/uGdm2&quot; rel=&quot;nofollow&quot;&gt;http://jsfiddle.net/uGdm2&lt;/a&gt;/&lt;br&gt;&lt;br&gt;Any ideas what I&#039;m doing wrong?</description>
		<content:encoded><![CDATA[<p>I had a go at this but with autocomplete and it didn&#39;t seem to work&#8230;</p>
<p>Here&#39;s my attempt: <a href="http://jsfiddle.net/uGdm2" rel="nofollow">http://jsfiddle.net/uGdm2</a>/</p>
<p>Any ideas what I&#39;m doing wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: amWirick</title>
		<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/#comment-107</link>
		<dc:creator>amWirick</dc:creator>
		<pubDate>Fri, 27 Aug 2010 02:36:41 +0000</pubDate>
		<guid isPermaLink="false">http://ejq.dev.appendto.com/?p=49#comment-107</guid>
		<description>Hello Nathan,&lt;br&gt;&lt;br&gt;Thanks for the comment! Removing die from a single DOM element will not result in any change in behavior by jQuery - &lt;a href=&quot;http://jsbin.com/agohu4/2/edit&quot; rel=&quot;nofollow&quot;&gt;http://jsbin.com/agohu4/2/edit&lt;/a&gt;&lt;br&gt;&lt;br&gt;Interesting though to say the least! It appears that to unbind you must use the same selector as that used with .live()&lt;br&gt;Check out these three pieces of jQuery core:&lt;br&gt;&lt;a href=&quot;http://james.padolsey.com/jquery/#v=1.4&amp;fn=jQuery.fn.die&quot; rel=&quot;nofollow&quot;&gt;http://james.padolsey.com/jquery/#v=1.4&amp;fn=jQue...&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://james.padolsey.com/jquery/#v=1.4&amp;fn=jQuery.fn.live&quot; rel=&quot;nofollow&quot;&gt;http://james.padolsey.com/jquery/#v=1.4&amp;fn=jQue...&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://james.padolsey.com/jquery/#v=1.4&amp;fn=_liveConvert&quot; rel=&quot;nofollow&quot;&gt;http://james.padolsey.com/jquery/#v=1.4&amp;fn=_liv...&lt;/a&gt;&lt;br&gt;&lt;br&gt;So with .live() a bind is occuring where the selector is actually being added as part of the namespace of the event. Thus on .die() the namespaced event will only match if the same selector is used.&lt;br&gt;&lt;br&gt;Also here is a more optimized version of the above post:&lt;br&gt;&lt;a href=&quot;http://jsbin.com/agohu4/4/edit&quot; rel=&quot;nofollow&quot;&gt;http://jsbin.com/agohu4/4/edit&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Hello Nathan,</p>
<p>Thanks for the comment! Removing die from a single DOM element will not result in any change in behavior by jQuery &#8211; <a href="http://jsbin.com/agohu4/2/edit" rel="nofollow">http://jsbin.com/agohu4/2/edit</a></p>
<p>Interesting though to say the least! It appears that to unbind you must use the same selector as that used with .live()<br />Check out these three pieces of jQuery core:<br /><a href="http://james.padolsey.com/jquery/#v=1.4&#038;fn=jQuery.fn.die" rel="nofollow">http://james.padolsey.com/jquery/#v=1.4&#038;fn=jQue&#8230;</a><br /><a href="http://james.padolsey.com/jquery/#v=1.4&#038;fn=jQuery.fn.live" rel="nofollow">http://james.padolsey.com/jquery/#v=1.4&#038;fn=jQue&#8230;</a><br /><a href="http://james.padolsey.com/jquery/#v=1.4&#038;fn=_liveConvert" rel="nofollow">http://james.padolsey.com/jquery/#v=1.4&#038;fn=_liv&#8230;</a></p>
<p>So with .live() a bind is occuring where the selector is actually being added as part of the namespace of the event. Thus on .die() the namespaced event will only match if the same selector is used.</p>
<p>Also here is a more optimized version of the above post:<br /><a href="http://jsbin.com/agohu4/4/edit" rel="nofollow">http://jsbin.com/agohu4/4/edit</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: amWirick</title>
		<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/#comment-105</link>
		<dc:creator>amWirick</dc:creator>
		<pubDate>Fri, 27 Aug 2010 01:38:47 +0000</pubDate>
		<guid isPermaLink="false">http://ejq.dev.appendto.com/?p=49#comment-105</guid>
		<description>Hello Nathan,&lt;br&gt;&lt;br&gt;Great point - true lazy loading with the loader removed after completion. I didn&#039;t think of that. Awesome!&lt;br&gt;&lt;br&gt;For now we&#039;ll consider this the reward people get for reading through the comments :). I&#039;ll consider how we can add this back in to the core post - perhaps as a final JS Bin at the end of the post.</description>
		<content:encoded><![CDATA[<p>Hello Nathan,</p>
<p>Great point &#8211; true lazy loading with the loader removed after completion. I didn&#39;t think of that. Awesome!</p>
<p>For now we&#39;ll consider this the reward people get for reading through the comments <img src='http://ejq.a2cdn.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I&#39;ll consider how we can add this back in to the core post &#8211; perhaps as a final JS Bin at the end of the post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Smith</title>
		<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/#comment-104</link>
		<dc:creator>Nathan Smith</dc:creator>
		<pubDate>Thu, 26 Aug 2010 10:14:31 +0000</pubDate>
		<guid isPermaLink="false">http://ejq.dev.appendto.com/?p=49#comment-104</guid>
		<description>Dude. Using mouseenter live wire-up to lazy load draggable functionality is genius.&lt;br&gt;&lt;br&gt;Just one suggestion, un-bind the mouseenter event once it&#039;s served it&#039;s purpose...&lt;br&gt;&lt;br&gt;$(foo).live(&#039;mouseenter&#039;, function() {&lt;br&gt;$(this).die(&#039;mouseenter&#039;).draggable({/* ... */});&lt;br&gt;});</description>
		<content:encoded><![CDATA[<p>Dude. Using mouseenter live wire-up to lazy load draggable functionality is genius.</p>
<p>Just one suggestion, un-bind the mouseenter event once it&#39;s served it&#39;s purpose&#8230;</p>
<p>$(foo).live(&#39;mouseenter&#39;, function() {<br />$(this).die(&#39;mouseenter&#39;).draggable({/* &#8230; */});<br />});</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Douglas Neiner</title>
		<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/#comment-98</link>
		<dc:creator>Douglas Neiner</dc:creator>
		<pubDate>Sun, 22 Aug 2010 22:06:59 +0000</pubDate>
		<guid isPermaLink="false">http://ejq.dev.appendto.com/?p=49#comment-98</guid>
		<description>Hey Cal! &lt;br&gt;&lt;br&gt;There is a selector created for each widget, so `:ui-datepicker` would work, but this article follows the pattern used internally in jQuery UI.&lt;br&gt;&lt;br&gt;The difference between `:ui-datepicker` and `:data(datepicker)` is the first will error if the UI DatePicker code is not included on the page, and the second will fail silently like most jQuery selectors that don&#039;t have a match. It makes the code slightly less coupled, though arguably either selector could probably be used.</description>
		<content:encoded><![CDATA[<p>Hey Cal! </p>
<p>There is a selector created for each widget, so `:ui-datepicker` would work, but this article follows the pattern used internally in jQuery UI.</p>
<p>The difference between `:ui-datepicker` and `:data(datepicker)` is the first will error if the UI DatePicker code is not included on the page, and the second will fail silently like most jQuery selectors that don&#39;t have a match. It makes the code slightly less coupled, though arguably either selector could probably be used.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cal</title>
		<link>http://enterprisejquery.com/2010/07/configuring-ui-widgets-and-interactions-with-live/#comment-97</link>
		<dc:creator>Cal</dc:creator>
		<pubDate>Sun, 22 Aug 2010 20:25:35 +0000</pubDate>
		<guid isPermaLink="false">http://ejq.dev.appendto.com/?p=49#comment-97</guid>
		<description>Hi, thank you for this nice technique.&lt;br&gt;&lt;br&gt;I&#039;ve seen in the jQuery UI widget sources that a &#039;:&#039; selector is created for each plugin. So it should be possible to do&lt;br&gt;&lt;br&gt;$this.is(&#039;:ui-datepicker&#039;)&lt;br&gt;&lt;br&gt;Haven&#039;t tested though.</description>
		<content:encoded><![CDATA[<p>Hi, thank you for this nice technique.</p>
<p>I&#39;ve seen in the jQuery UI widget sources that a &#39;:&#39; selector is created for each plugin. So it should be possible to do</p>
<p>$this.is(&#39;:ui-datepicker&#39;)</p>
<p>Haven&#39;t tested though.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using apc
Database Caching 2/7 queries in 0.001 seconds using apc
Content Delivery Network via ejq.a2cdn.net

Served from: enterprisejquery.com @ 2012-02-05 12:54:38 -->
