| |
Low Pro |
On 1/26/08, Dan Webb <d...@danwebb.net> wrote: http://svn.danwebb.net/external/lowpro-jq/trunk Warning: I've literally just bashed this out so its not ready for http://svn.danwebb.net/external/lowpro-jq/trunk/test/test.html But the rundown is... Create a behavior as a class: Testy = $.klass({ Then attach it on ready in the jQuery way: jQuery(function($) { Another little bonus is that if you are running livequery it does some So, I think it needs some more bashing (and some unit tests) and I What do ya'll think? After sitting and coding it Im actually really Cheers, Dan -- aim: danwrong123
usage but you can get an idea of how it goes together by looking at:
initialize: function(arg) {
alert('ive just been attached with the arg ' + arg);
},
onclick: function() {
alert('ive been clicked');
}
get that as a bonus and can use all the inheritance stuff in the same
way.
$('p').attach(Testy, 'My arg');
magic and automagically attaches new instances of the behaviour
whenever the DOM is changed so for the above example if you
$(document.body).append('<p>Another para</p>') then it gets its own
behavior instance as well.
think it would be good to ship with some behaviors like normal Low Pro
does. Probably Remote and Observed...
pleased with how it turned out. It's much simpler than the Prototype
implementation and fits jquery's style a lot more. I might defect :)
Dan Webb
http://www.danwebb.net
skype: danwrong