Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Prototype + lowpro vs. JQuery
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Dan Webb  
View profile   Translate to Translated (View Original)
 More options 26 Jan 2008, 14:30
From: "Dan Webb" <d...@danwebb.net>
Date: Sat, 26 Jan 2008 14:30:11 +0000
Local: Sat 26 Jan 2008 14:30
Subject: Re: Prototype + lowpro vs. JQuery
On 1/26/08, Dan Webb <d...@danwebb.net> wrote:

> I'll see what I can put together.

We'll I've made a start and I must stay it works really nicely with jQuery.

http://svn.danwebb.net/external/lowpro-jq/trunk

Warning:  I've literally just bashed this out so its not ready for
usage but you can get an idea of how it goes together by looking at:

http://svn.danwebb.net/external/lowpro-jq/trunk/test/test.html

But the rundown is...

Create a behavior as a class:

Testy = $.klass({
  initialize: function(arg) {
    alert('ive just been attached with the arg ' + arg);
  },
  onclick: function() {
    alert('ive been clicked');
  }

});

Btw, $.klass is a full port of the Prototype Class.create stuff so you
get that as a bonus and can use all the inheritance stuff in the same
way.

Then attach it on ready in the jQuery way:

jQuery(function($) {
  $('p').attach(Testy, 'My arg');

});

And that's it.  Works the same for this point on.

Another little bonus is that if you are running livequery it does some
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.

So, I think it needs some more bashing (and some unit tests) and I
think it would be good to ship with some behaviors like normal Low Pro
does.  Probably Remote and Observed...

What do ya'll think?  After sitting and coding it Im actually really
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 :)

Cheers,

Dan

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

aim: danwrong123
skype: danwrong


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google