<?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"
	>
<channel>
	<title>Comments on: Cleaning your markup with dojo.behavior</title>
	<atom:link href="http://dojocampus.org/content/2008/03/26/cleaning-your-markup-with-dojobehavior/feed/" rel="self" type="application/rss+xml" />
	<link>http://dojocampus.org/content/2008/03/26/cleaning-your-markup-with-dojobehavior/</link>
	<description>The definitive resource for all things Dojo: past, present, future.</description>
	<pubDate>Tue, 06 Jan 2009 20:15:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: pottedmeat</title>
		<link>http://dojocampus.org/content/2008/03/26/cleaning-your-markup-with-dojobehavior/#comment-121</link>
		<dc:creator>pottedmeat</dc:creator>
		<pubDate>Thu, 24 Apr 2008 12:49:28 +0000</pubDate>
		<guid isPermaLink="false">http://dojocampus.org/content/?p=90#comment-121</guid>
		<description>@Seth, there's a major difference. dojo.behavior manages the application of the behaviors.

So if you add a node to the document, then use apply, it won't re-apply the behavior to nodes that have already been matched.</description>
		<content:encoded><![CDATA[<p>@Seth, there&#8217;s a major difference. dojo.behavior manages the application of the behaviors.</p>
<p>So if you add a node to the document, then use apply, it won&#8217;t re-apply the behavior to nodes that have already been matched.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seth</title>
		<link>http://dojocampus.org/content/2008/03/26/cleaning-your-markup-with-dojobehavior/#comment-66</link>
		<dc:creator>seth</dc:creator>
		<pubDate>Fri, 28 Mar 2008 22:55:36 +0000</pubDate>
		<guid isPermaLink="false">http://dojocampus.org/content/?p=90#comment-66</guid>
		<description>strange...it doesn't work for me on FF2/Ubuntu 7.10 (unless my focus is in a text box or text area).  when I add a found event, it finds it.

&#62;&#62; dojo.require("dojo.behavior");
&#62;&#62; dojo.behavior.add({ 'body' : { found: function(e) { console.debug(e); }, onkeypress:function(e) { console.debug('o hai', e); } } });
&#62;&#62; dojo.behavior.apply();

Thanks for the reply....</description>
		<content:encoded><![CDATA[<p>strange&#8230;it doesn&#8217;t work for me on FF2/Ubuntu 7.10 (unless my focus is in a text box or text area).  when I add a found event, it finds it.</p>
<p>&gt;&gt; dojo.require(&#8221;dojo.behavior&#8221;);<br />
&gt;&gt; dojo.behavior.add({ &#8216;body&#8217; : { found: function(e) { console.debug(e); }, onkeypress:function(e) { console.debug(&#8217;o hai&#8217;, e); } } });<br />
&gt;&gt; dojo.behavior.apply();</p>
<p>Thanks for the reply&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Coup</title>
		<link>http://dojocampus.org/content/2008/03/26/cleaning-your-markup-with-dojobehavior/#comment-65</link>
		<dc:creator>Robert Coup</dc:creator>
		<pubDate>Fri, 28 Mar 2008 21:32:31 +0000</pubDate>
		<guid isPermaLink="false">http://dojocampus.org/content/?p=90#comment-65</guid>
		<description>Hi Seth,

Adding behaviours to body seems to work for me - dojo.behavior applies its queries to the document so everything should fall into its scope.

&gt; dojo.behavior.add({ 'body' : { onkeypress:function(e) { console.debug('o hai', e); } } });
&gt; dojo.behavior.apply();

In FF2/OSX keys pressed with no element focussed ran the auto-search functionality instead, but it worked fine in a textarea on the page.

- Rob :)</description>
		<content:encoded><![CDATA[<p>Hi Seth,</p>
<p>Adding behaviours to body seems to work for me - dojo.behavior applies its queries to the document so everything should fall into its scope.</p>
<p>> dojo.behavior.add({ &#8216;body&#8217; : { onkeypress:function(e) { console.debug(&#8217;o hai&#8217;, e); } } });<br />
> dojo.behavior.apply();</p>
<p>In FF2/OSX keys pressed with no element focussed ran the auto-search functionality instead, but it worked fine in a textarea on the page.</p>
<p>- Rob <img src='http://dojocampus.org/content/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seth</title>
		<link>http://dojocampus.org/content/2008/03/26/cleaning-your-markup-with-dojobehavior/#comment-64</link>
		<dc:creator>seth</dc:creator>
		<pubDate>Fri, 28 Mar 2008 18:09:36 +0000</pubDate>
		<guid isPermaLink="false">http://dojocampus.org/content/?p=90#comment-64</guid>
		<description>Speaking of doing it wrong, I had buggy code....should have been *document.getElementsByTagName("body")*

Now it behaves the same as dojo.behavior.  Anyway to use dojo.behavior so it binds to the whole page? :)</description>
		<content:encoded><![CDATA[<p>Speaking of doing it wrong, I had buggy code&#8230;.should have been *document.getElementsByTagName(&#8221;body&#8221;)*</p>
<p>Now it behaves the same as dojo.behavior.  Anyway to use dojo.behavior so it binds to the whole page? <img src='http://dojocampus.org/content/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seth</title>
		<link>http://dojocampus.org/content/2008/03/26/cleaning-your-markup-with-dojobehavior/#comment-63</link>
		<dc:creator>seth</dc:creator>
		<pubDate>Fri, 28 Mar 2008 00:17:10 +0000</pubDate>
		<guid isPermaLink="false">http://dojocampus.org/content/?p=90#comment-63</guid>
		<description>So, I gave dojo.behavior a whirl.  I tried to set up a keyboard command to make something happen, so I did this:

dojo.require("dojo.behavior");
dojo.behavior.add( {
body: { 
   onkeypress: function(evt) { console.log("ur doin it wrong") }
    }
});
dojo.behavior.apply();

That didn't do anything unless I click in a text box and start typing. I expteced the event to fire if I clicked anywhere on hit the keyboard command.

Yet, when I do this:
dojo.connect(document.getElementsByName("body")[0],
    "onkeypress",
     function(evt) {
        console.log("o hai!");
     }
);

and click anywhere on the page (like on an empty div) and start typing, it'll output 'o hai'

I realize this might not be the place to post this but I figured I'd stop here before I dove into the forums.

Thanks in advance.</description>
		<content:encoded><![CDATA[<p>So, I gave dojo.behavior a whirl.  I tried to set up a keyboard command to make something happen, so I did this:</p>
<p>dojo.require(&#8221;dojo.behavior&#8221;);<br />
dojo.behavior.add( {<br />
body: {<br />
   onkeypress: function(evt) { console.log(&#8221;ur doin it wrong&#8221;) }<br />
    }<br />
});<br />
dojo.behavior.apply();</p>
<p>That didn&#8217;t do anything unless I click in a text box and start typing. I expteced the event to fire if I clicked anywhere on hit the keyboard command.</p>
<p>Yet, when I do this:<br />
dojo.connect(document.getElementsByName(&#8221;body&#8221;)[0],<br />
    &#8220;onkeypress&#8221;,<br />
     function(evt) {<br />
        console.log(&#8221;o hai!&#8221;);<br />
     }<br />
);</p>
<p>and click anywhere on the page (like on an empty div) and start typing, it&#8217;ll output &#8216;o hai&#8217;</p>
<p>I realize this might not be the place to post this but I figured I&#8217;d stop here before I dove into the forums.</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Coup</title>
		<link>http://dojocampus.org/content/2008/03/26/cleaning-your-markup-with-dojobehavior/#comment-61</link>
		<dc:creator>Robert Coup</dc:creator>
		<pubDate>Thu, 27 Mar 2008 04:35:07 +0000</pubDate>
		<guid isPermaLink="false">http://dojocampus.org/content/?p=90#comment-61</guid>
		<description>Hi Seth,

Thanks!

There's no technical difference between them. It really appeals to me because it's clean - at a glance i can see what behaviours are applying to which nodes - no addOnLoad() blocks full of repeated calls to dojo.query(). In one app we have several modules that might combine on a page - each has a behaviours section with a call to dojo.behavior.add() in it - you know where to look, and its not mixed up with other onLoad code.

Rob :)</description>
		<content:encoded><![CDATA[<p>Hi Seth,</p>
<p>Thanks!</p>
<p>There&#8217;s no technical difference between them. It really appeals to me because it&#8217;s clean - at a glance i can see what behaviours are applying to which nodes - no addOnLoad() blocks full of repeated calls to dojo.query(). In one app we have several modules that might combine on a page - each has a behaviours section with a call to dojo.behavior.add() in it - you know where to look, and its not mixed up with other onLoad code.</p>
<p>Rob <img src='http://dojocampus.org/content/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seth</title>
		<link>http://dojocampus.org/content/2008/03/26/cleaning-your-markup-with-dojobehavior/#comment-60</link>
		<dc:creator>seth</dc:creator>
		<pubDate>Thu, 27 Mar 2008 03:24:36 +0000</pubDate>
		<guid isPermaLink="false">http://dojocampus.org/content/?p=90#comment-60</guid>
		<description>Nice article.  

What are the advantages of using dojo.behavior, vs. dojo.query.connect or dojo.connect?  Centralized location of code?</description>
		<content:encoded><![CDATA[<p>Nice article.  </p>
<p>What are the advantages of using dojo.behavior, vs. dojo.query.connect or dojo.connect?  Centralized location of code?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
