Go to Google Groups Home    Low Pro
Re: Prototype + lowpro vs. JQuery

Dan Webb <d...@danwebb.net>

> initEvents({
>  'a.alert_hello_world:click': function(event){

>  alert("Hello World!"); event.preventDefault();
>  },

>  'p.hide_myself:click': function() {
>  // this refers to the paragraph being clicked
>  $(this).hide();
>  }
> });

Yeah, well, I've not ported any of that Low Pro at all.  I figure that
what you already get:

jQuery(function($) {
  $('div.product').click(function() { ..... });
  $('a').click(function() { ..... });

});

...is just as clean as Event.addBehavior.  I've basically just brought
across the behavior classes part.

> Chris from Err the blog, mentioned that he was excited about seeing LowPro
> being ported to JQuery, he just whished you were using click instead of
> onclick.

The on being at the start of methods that catch events is an important
part.  We need to differenciate which methods are intended to catch
events and which are just normal methods.  If we do this then behavior
classes can catch custom events as well which is a very good thing.

> I'm personally really excited, especially with the new Merb release coming
> up, I believe JQuery will grow in the Ruby community. I'll do my best to try
> to see if I can come up with behaviors.

Yeah, I'm liking how its turned out so far.  My only reservation is
that what behavior classes do can and is currently done using plugins:

$('input').attach(DatePicker);

could be done as:

$('input').attachDatePicker();

However, I think behavior classes have advantages over this method on
accounts that they are actual classes that you can inherit from and
augment yourself.  The only way you can customise plugins is to crack
open the source and change it which is never ideal.

Cheers,

Dan

--
Dan Webb
http://www.danwebb.net

aim: danwrong123
skype: danwrong