<pedrocorreia.net ⁄>
 

<Macros in jQuery ⁄ >




clicks: 676 676 2009-12-30 2009-12-30 goto programacao myNews programacao  Bookmark This Bookmark This


Creating a plugin for jQuery is incredibly simple and is a very useful way to abstract complex behaviours so that they can be used repeatedly as part of your jQuery "chains".

But, when the time comes, and you're faced with the decision to either create a jQuery plugin or to simply create a regular function, everything suddenly becomes quite complicated. First, you'll wonder whether the piece of behaviour you want to abstract is best kept under the jQuery namespace, and then you'll doubt its applicability to the DOM-centred jQuery chain, and then sometimes you'll recede to something you're much more comfortable with, a regular ol' JavaScript function.

If we forget about the plugins available online, and we simply focus on your plugins, made and used within a specific project, then the question of whether a plugin is really the right route becomes all the more difficult to answer. Are you going to benefit from extending jQuery's API? Will the readability of your code benefit?



este é só um excerto do artigo, para aceder ao artigo completo, clique no link em baixo:
this is just a small excerpt from the article, to access the full article please click in the link below:

http://james.padolsey.com/javascript/macros-in-jquery/




Subscribe News RSS  Subscribe News Updates by E-mail





myNews <myNews show="rand" cat="programacao" ⁄>

RouterJs: easy routing for your ajax Web applications

RouterJs is a simple router for your ajax web apps. It's build upon History.js which means that Rout (...)

clicks: 100 100 2012-05-14 2012-05-14 goto url (new window) haithembelhaj.g... goto myNews programacao


Backbone computed properties

This gist shows one way to implement read- and write-enabled computed properties on a Backbone Model (...)

clicks: 114 114 2012-05-13 2012-05-13 goto url (new window) https://gist.gi... goto myNews programacao


Create Instagram Filters With PHP

In this tutorial, I'll demonstrate how to create vintage (just like Instagram does) photos with PHP (...)

clicks: 110 110 2012-05-12 2012-05-12 goto url (new window) net.tutsplus.co... goto myNews programacao


HTML5 jQuery Paint Plugin

Websanova Paint is a HTML5 canvas based jQuery plugin. It allows you to free paint on a canvas area (...)

clicks: 103 103 2012-05-12 2012-05-12 goto url (new window) websanova.com/t... goto myNews programacao


Android Query

Android-Query (AQuery) is a light-weight library for doing asynchronous tasks and manipulating UI el (...)

clicks: 111 111 2012-05-12 2012-05-12 goto url (new window) code.google.com... goto myNews programacao


Sass vs. LESS vs. Stylus: Preprocessor Shootout

CSS3 preprocessors are languages written for the sole purpose of adding cool, inventive features to (...)

clicks: 117 117 2012-05-11 2012-05-11 goto url (new window) net.tutsplus.co... goto myNews programacao


Real-time Applications With Node.js and Socket.IO

Hey everyone! Sorry about the long pause since the last blog post, life has been quite hectic for th (...)

clicks: 113 113 2012-05-11 2012-05-11 goto url (new window) codingcookies.c... goto myNews programacao


Gettings to know Backbone.ks

In this series, we're going to learn how to build a fully functional contacts manager using Backbone (...)

clicks: 123 123 2012-05-10 2012-05-10 goto url (new window) net.tutsplus.co... goto myNews programacao