<?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: Namespace Your Events</title>
	<atom:link href="http://www.learningjquery.com/2007/09/namespace-your-events/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com/2007/09/namespace-your-events</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:50:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Randy</title>
		<link>http://www.learningjquery.com/2007/09/namespace-your-events/comment-page-1#comment-84694</link>
		<dc:creator>Randy</dc:creator>
		<pubDate>Mon, 21 Nov 2011 12:49:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/09/namespace-your-events#comment-84694</guid>
		<description>Beautiful! I made a jQuery plugin that makes a DOM element bordered and binds a click event handler that toggles the border color. No worry now about other plugins unbinding my plugin&#039;s handler and vice versa.

&lt;pre&gt;&lt;code&gt;
$.fn.extend({
        clicked: function() {
            this.addClass(&#039;clicked off&#039;);
            return this.bind(&#039;click.clicked&#039;, function() { //namespaced handler
                $(this).toggleClass(&#039;on off&#039;);
            });
        },
        unclicked: function() { //namespaced handler
            return this.removeClass(&#039;clicked on off&#039;).unbind(&#039;click.clicked&#039;);
        }
    });

// e.g. $(&#039;#border_flasher&#039;).clicked(); &lt;-- makes element border flashable
//      $(&#039;#border_flasher&#039;).unclicked(); &lt;-- safely unbinds handler that .clicked() bound

&lt;/code&gt;&lt;/pre&gt; 

In CSS I style all the border except the color in the &#039;clicked&#039; class and the border colors are styled in  the &#039;on&#039; and &#039;off&#039; classes. Works well so far. I love this site! So much useful info for those on the jQuery learning curve.</description>
		<content:encoded><![CDATA[<p>Beautiful! I made a jQuery plugin that makes a DOM element bordered and binds a click event handler that toggles the border color. No worry now about other plugins unbinding my plugin&#8217;s handler and vice versa.</p>
<pre><code>
$.fn.extend({
        clicked: function() {
            this.addClass('clicked off');
            return this.bind('click.clicked', function() { //namespaced handler
                $(this).toggleClass('on off');
            });
        },
        unclicked: function() { //namespaced handler
            return this.removeClass('clicked on off').unbind('click.clicked');
        }
    });

// e.g. $('#border_flasher').clicked(); &lt;-- makes element border flashable
//      $(&#039;#border_flasher&#039;).unclicked(); &lt;-- safely unbinds handler that .clicked() bound

</code></pre>
<p>In CSS I style all the border except the color in the &#8216;clicked&#8217; class and the border colors are styled in  the &#8216;on&#8217; and &#8216;off&#8217; classes. Works well so far. I love this site! So much useful info for those on the jQuery learning curve.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jQuery 1.7 Beta 1 Released &#124; Code to Preload</title>
		<link>http://www.learningjquery.com/2007/09/namespace-your-events/comment-page-1#comment-84518</link>
		<dc:creator>jQuery 1.7 Beta 1 Released &#124; Code to Preload</dc:creator>
		<pubDate>Tue, 11 Oct 2011 04:19:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/09/namespace-your-events#comment-84518</guid>
		<description>[...] Over time, jQuery has evolved three ways to attach events to elements: .bind() , .live(), and .delegate(). Underneath it all, though, the three event APIs call the browser&#8217;s event system; that can lead to surprising interactions. For example, $(document).unbind(&quot;click&quot;) will remove all .live(&quot;click&quot;, ...) events, since those delegated events are attached to document. (This is also why you should use event namespaces.) [...]</description>
		<content:encoded><![CDATA[<p>[...] Over time, jQuery has evolved three ways to attach events to elements: .bind() , .live(), and .delegate(). Underneath it all, though, the three event APIs call the browser&#8217;s event system; that can lead to surprising interactions. For example, $(document).unbind(&quot;click&quot;) will remove all .live(&quot;click&quot;, &#8230;) events, since those delegated events are attached to document. (This is also why you should use event namespaces.) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jQuery: &#187; jQuery 1.7 Beta 1 Released</title>
		<link>http://www.learningjquery.com/2007/09/namespace-your-events/comment-page-1#comment-84479</link>
		<dc:creator>jQuery: &#187; jQuery 1.7 Beta 1 Released</dc:creator>
		<pubDate>Wed, 28 Sep 2011 22:28:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/09/namespace-your-events#comment-84479</guid>
		<description>[...] Over time, jQuery has evolved three ways to attach events to elements: .bind() , .live(), and .delegate(). Underneath it all, though, the three event APIs call the browser&#8217;s event system; that can lead to surprising interactions. For example, $(document).unbind(&quot;click&quot;) will remove all .live(&quot;click&quot;, ...) events, since those delegated events are attached to document. (This is also why you should use event namespaces.) [...]</description>
		<content:encoded><![CDATA[<p>[...] Over time, jQuery has evolved three ways to attach events to elements: .bind() , .live(), and .delegate(). Underneath it all, though, the three event APIs call the browser&#8217;s event system; that can lead to surprising interactions. For example, $(document).unbind(&quot;click&quot;) will remove all .live(&quot;click&quot;, &#8230;) events, since those delegated events are attached to document. (This is also why you should use event namespaces.) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken</title>
		<link>http://www.learningjquery.com/2007/09/namespace-your-events/comment-page-1#comment-79674</link>
		<dc:creator>Ken</dc:creator>
		<pubDate>Sat, 06 Feb 2010 13:36:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/09/namespace-your-events#comment-79674</guid>
		<description>In jQuery 1.3.2 , you can also trigger an &quot;exclusive&quot; event, meaning only non-namespaced events are triggered. You do this by supplying e.g. &quot;click!&quot; as the event name.
&lt;a href=&quot;http://longgoldenears.blogspot.com/2010/02/jquery-namespaced-events-exclusive.html&quot; rel=&quot;nofollow&quot;&gt;See my post here&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>In jQuery 1.3.2 , you can also trigger an &#8220;exclusive&#8221; event, meaning only non-namespaced events are triggered. You do this by supplying e.g. &#8220;click!&#8221; as the event name.<br />
<a href="http://longgoldenears.blogspot.com/2010/02/jquery-namespaced-events-exclusive.html" rel="nofollow">See my post here</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Working with Events, part 2 &#124; haojii</title>
		<link>http://www.learningjquery.com/2007/09/namespace-your-events/comment-page-1#comment-79575</link>
		<dc:creator>Working with Events, part 2 &#124; haojii</dc:creator>
		<pubDate>Tue, 19 Jan 2010 14:11:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/09/namespace-your-events#comment-79575</guid>
		<description>[...] 请阅读Brandon Aaron的文章以了解更多关于事件名称空间的知识： Namespace Your Events. [...]</description>
		<content:encoded><![CDATA[<p>[...] 请阅读Brandon Aaron的文章以了解更多关于事件名称空间的知识： Namespace Your Events. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arjun</title>
		<link>http://www.learningjquery.com/2007/09/namespace-your-events/comment-page-1#comment-78903</link>
		<dc:creator>Arjun</dc:creator>
		<pubDate>Sat, 26 Sep 2009 08:55:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/09/namespace-your-events#comment-78903</guid>
		<description>Thanks, that was what I was looking for :)</description>
		<content:encoded><![CDATA[<p>Thanks, that was what I was looking for :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Working with Events, part 2 &#187; Learning jQuery - Tutorials and Information</title>
		<link>http://www.learningjquery.com/2007/09/namespace-your-events/comment-page-1#comment-63757</link>
		<dc:creator>Working with Events, part 2 &#187; Learning jQuery - Tutorials and Information</dc:creator>
		<pubDate>Sun, 07 Dec 2008 21:40:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/09/namespace-your-events#comment-63757</guid>
		<description>[...] For more information about event namespacing, read Brandon Aaron&#039;s article, Namespace Your Events. [...]</description>
		<content:encoded><![CDATA[<p>[...] For more information about event namespacing, read Brandon Aaron&#8217;s article, Namespace Your Events. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: &#160; jQuery Autocomplete Plugin&#160;by&#160;bigredswitch</title>
		<link>http://www.learningjquery.com/2007/09/namespace-your-events/comment-page-1#comment-63478</link>
		<dc:creator>&#160; jQuery Autocomplete Plugin&#160;by&#160;bigredswitch</dc:creator>
		<pubDate>Mon, 10 Nov 2008 00:02:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/09/namespace-your-events#comment-63478</guid>
		<description>[...] like &#8216;click.autocomplete&#8217; were. Turns out that jQuery has a mechanism where you can namespace your events. Here is another writeup about it. Nice [...]</description>
		<content:encoded><![CDATA[<p>[...] like &#8216;click.autocomplete&#8217; were. Turns out that jQuery has a mechanism where you can namespace your events. Here is another writeup about it. Nice [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2007/09/namespace-your-events/comment-page-1#comment-49206</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Tue, 10 Jun 2008 23:27:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/09/namespace-your-events#comment-49206</guid>
		<description>Hi Nanda,

Try something like this:

&lt;pre&gt;&lt;code&gt;$(&#039;body&#039;).bind(&#039;click&#039;, function(e) {
  if (e.target.nodeName != TEXTAREA) {
    // do something
  }
});&lt;/code&gt;&lt;/pre&gt;

No need for the unbind.</description>
		<content:encoded><![CDATA[<p>Hi Nanda,</p>
<p>Try something like this:</p>
<pre><code>$('body').bind('click', function(e) {
  if (e.target.nodeName != TEXTAREA) {
    // do something
  }
});</code></pre>
<p>No need for the unbind.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nanda</title>
		<link>http://www.learningjquery.com/2007/09/namespace-your-events/comment-page-1#comment-49166</link>
		<dc:creator>Nanda</dc:creator>
		<pubDate>Tue, 10 Jun 2008 04:19:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/09/namespace-your-events#comment-49166</guid>
		<description>First I would like to congradulate you on this blog and I have found the writeup useful.

However I have a problem where I bind a click function to the entire document but then want to unbind for a specific element in this case a textarea so that clicks inside the textarea do not trigger the anonymous function.  Could using namespace s solve the problem.

I have provided the jQuery code I am using to tdo this below:
&lt;pre&gt;&lt;code&gt;
entire_document.bind(&#039;click&#039;, function(e)
	{
		jQuery(&#039;#textareaid&#039;).unbind(&#039;click&#039;);
                 if (condition)
                 {
                        // do some stuff
                  }
                 else 
                  {
                         // do some other stuff
                   }
        entire_document.unbind(&#039;click&#039;);
	});</description>
		<content:encoded><![CDATA[<p>First I would like to congradulate you on this blog and I have found the writeup useful.</p>
<p>However I have a problem where I bind a click function to the entire document but then want to unbind for a specific element in this case a textarea so that clicks inside the textarea do not trigger the anonymous function.  Could using namespace s solve the problem.</p>
<p>I have provided the jQuery code I am using to tdo this below:</p>
<pre><code>
entire_document.bind('click', function(e)
	{
		jQuery('#textareaid').unbind('click');
                 if (condition)
                 {
                        // do some stuff
                  }
                 else
                  {
                         // do some other stuff
                   }
        entire_document.unbind('click');
	});</code></pre>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced (User agent is rejected)
Database Caching 7/19 queries in 0.005 seconds using disk: basic
Object Caching 371/374 objects using disk: basic
Content Delivery Network via learningjquery.kswedberg.netdna-cdn.com

Served from: www.learningjquery.com @ 2012-02-08 14:06:23 -->
