<?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/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Using MooTools&#8217; Alias&#160;Functionality</title> <atom:link href="http://davidwalsh.name/mootools-alias/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/mootools-alias</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Thu, 09 Feb 2012 02:40:12 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>By: Goutte</title><link>http://davidwalsh.name/mootools-alias/comment-page-1#comment-26330</link> <dc:creator>Goutte</dc:creator> <pubDate>Wed, 03 Aug 2011 14:57:51 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=829#comment-26330</guid> <description>Note that the parameters have been reversed in newer Mootools (using 1.3.2) versions :
&lt;code&gt;
Element.alias(&#039;shank&#039;, &#039;dispose&#039;);
Element.alias(&#039;concreteShoes&#039;, &#039;dispose&#039;);
&lt;/code&gt;
etc.</description> <content:encoded><![CDATA[<p>Note that the parameters have been reversed in newer Mootools (using 1.3.2) versions :<br
/> <code><br
/> Element.alias('shank', 'dispose');<br
/> Element.alias('concreteShoes', 'dispose');<br
/> </code><br
/> etc.</p> ]]></content:encoded> </item> <item><title>By: Aaron Newton</title><link>http://davidwalsh.name/mootools-alias/comment-page-1#comment-4140</link> <dc:creator>Aaron Newton</dc:creator> <pubDate>Mon, 08 Dec 2008 21:32:37 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=829#comment-4140</guid> <description>Damned formatting. I indented that crap!</description> <content:encoded><![CDATA[<p>Damned formatting. I indented that crap!</p> ]]></content:encoded> </item> <item><title>By: Aaron Newton</title><link>http://davidwalsh.name/mootools-alias/comment-page-1#comment-4139</link> <dc:creator>Aaron Newton</dc:creator> <pubDate>Mon, 08 Dec 2008 21:32:10 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=829#comment-4139</guid> <description>This got a chuckle out of me. The .shank example was choice.@Ryan, alias just creates an extra pointer to a method, so it doesn&#039;t work with events.@Ronny-Andre David is correct; the expense here is nil. It doesn&#039;t invoke some methodology every time you call .each or anything. The alias function just applies it&#039;s logic when it is parsed and after that you have two pointers to the same method.As for using this to create your own fun names for things, you certainly could. I think that a far more powerful method for creating your own functionality for native elements is the custom methods that MooTools allows you to define. For instance, look at the element shortcuts in Fx.Tween:Element.implement({
//there are other shortcuts, but let&#039;s just look at highlight...
highlight: function(start, end){
if (!end){
end = this.retrieve(&#039;highlight:original&#039;, this.getStyle(&#039;background-color&#039;));
end = (end == &#039;transparent&#039;) ? &#039;#fff&#039; : end;
}
var tween = this.get(&#039;tween&#039;);
tween.start(&#039;background-color&#039;, start &#124;&#124; &#039;#ffff88&#039;, end).chain(function(){
this.setStyle(&#039;background-color&#039;, this.retrieve(&#039;highlight:original&#039;));
tween.callChain();
}.bind(this));
return this;
}
});Using implement (combine with element storage) you can create a lot of customized behavior. For instance, &lt;a href=&quot;http://davidwalsh.name/implement-jquery-click-syntax-mootools&quot; rel=&quot;nofollow&quot;&gt;let&#039;s say you liked jQuery&#039;s method for adding click events&lt;/a&gt;.</description> <content:encoded><![CDATA[<p>This got a chuckle out of me. The .shank example was choice.</p><p>@Ryan, alias just creates an extra pointer to a method, so it doesn&#8217;t work with events.</p><p>@Ronny-Andre David is correct; the expense here is nil. It doesn&#8217;t invoke some methodology every time you call .each or anything. The alias function just applies it&#8217;s logic when it is parsed and after that you have two pointers to the same method.</p><p>As for using this to create your own fun names for things, you certainly could. I think that a far more powerful method for creating your own functionality for native elements is the custom methods that MooTools allows you to define. For instance, look at the element shortcuts in Fx.Tween:</p><p>Element.implement({<br
/> //there are other shortcuts, but let&#8217;s just look at highlight&#8230;<br
/> highlight: function(start, end){<br
/> if (!end){<br
/> end = this.retrieve(&#8216;highlight:original&#8217;, this.getStyle(&#8216;background-color&#8217;));<br
/> end = (end == &#8216;transparent&#8217;) ? &#8216;#fff&#8217; : end;<br
/> }<br
/> var tween = this.get(&#8216;tween&#8217;);<br
/> tween.start(&#8216;background-color&#8217;, start || &#8216;#ffff88&#8242;, end).chain(function(){<br
/> this.setStyle(&#8216;background-color&#8217;, this.retrieve(&#8216;highlight:original&#8217;));<br
/> tween.callChain();<br
/> }.bind(this));<br
/> return this;<br
/> }<br
/> });</p><p>Using implement (combine with element storage) you can create a lot of customized behavior. For instance, <a
href="http://davidwalsh.name/implement-jquery-click-syntax-mootools" rel="nofollow">let&#8217;s say you liked jQuery&#8217;s method for adding click events</a>.</p> ]]></content:encoded> </item> <item><title>By: david</title><link>http://davidwalsh.name/mootools-alias/comment-page-1#comment-4137</link> <dc:creator>david</dc:creator> <pubDate>Mon, 08 Dec 2008 18:46:43 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=829#comment-4137</guid> <description>&lt;p&gt;@Ronny-André: The speed difference must be slim to none.  MooTools uses &#039;.each&#039; everywhere.&lt;/p&gt;&lt;p&gt;@Ryan:  I don&#039;t believe that alias would be applicable to your example.&lt;/p&gt;</description> <content:encoded><![CDATA[<p>@Ronny-André: The speed difference must be slim to none.  MooTools uses &#8216;.each&#8217; everywhere.</p><p>@Ryan:  I don&#8217;t believe that alias would be applicable to your example.</p> ]]></content:encoded> </item> <item><title>By: Ryan</title><link>http://davidwalsh.name/mootools-alias/comment-page-1#comment-4136</link> <dc:creator>Ryan</dc:creator> <pubDate>Mon, 08 Dec 2008 18:38:12 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=829#comment-4136</guid> <description>I never knew that alias existed! I&#039;ve always wanted a short version for domready. Could alias handle that or would be better to just extend Window?</description> <content:encoded><![CDATA[<p>I never knew that alias existed! I&#8217;ve always wanted a short version for domready. Could alias handle that or would be better to just extend Window?</p> ]]></content:encoded> </item> <item><title>By: Ronny-André</title><link>http://davidwalsh.name/mootools-alias/comment-page-1#comment-4135</link> <dc:creator>Ronny-André</dc:creator> <pubDate>Mon, 08 Dec 2008 18:10:39 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=829#comment-4135</guid> <description>Quite funny actually! But how much is this slowing JavaScript down, as it has to go an extra step to check what the function is an alias for?</description> <content:encoded><![CDATA[<p>Quite funny actually! But how much is this slowing JavaScript down, as it has to go an extra step to check what the function is an alias for?</p> ]]></content:encoded> </item> <item><title>By: Brent Anderson</title><link>http://davidwalsh.name/mootools-alias/comment-page-1#comment-4134</link> <dc:creator>Brent Anderson</dc:creator> <pubDate>Mon, 08 Dec 2008 18:07:04 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=829#comment-4134</guid> <description>So I just got in trouble in a study hall for laughing out loud at &quot;$(&#039;prisoner&#039;).shank();&quot;. That&#039;s hilarious.</description> <content:encoded><![CDATA[<p>So I just got in trouble in a study hall for laughing out loud at &#8220;$(&#8216;prisoner&#8217;).shank();&#8221;. That&#8217;s hilarious.</p> ]]></content:encoded> </item> <item><title>By: Jack</title><link>http://davidwalsh.name/mootools-alias/comment-page-1#comment-4131</link> <dc:creator>Jack</dc:creator> <pubDate>Mon, 08 Dec 2008 16:50:58 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=829#comment-4131</guid> <description>Great functionality and funny too..!!</description> <content:encoded><![CDATA[<p>Great functionality and funny too..!!</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching using disk: basic
Object Caching 735/736 objects using disk: basic

Served from: davidwalsh.name @ 2012-02-09 00:37:32 -->
