Low Pro 0.5: Now Compatible With Prototype 1.6

Today I tagged Low Pro 0.5 for release which now works with Prototype 1.6. There are a number of things about this release that are worth mentioning aside from the compatibility. Firstly, it’s gotten a little smaller as Prototype core now includes most of the functionality Low Pro used to add (DOM Ready support, inserting using DOM nodes and a lot more). It’s also got a couple of new features so here’s a rundown:

  1. Event.onReady delegates to the new dom:loaded event: Except that as before if functions are added after the DOM is loaded they fire immediately.
  2. DOMBuilder now delegates to Prototype’s new Element: Now difference in usage here though, just less code.
  3. Low Pro’s DOM methods are now gone: Prototype core does everything you should need now.
  4. Behavior.create() works just like the new Class.create(): Yes, you can now create behavior classes that inherit from other behaviors (or indeed any other class). See the Prototype’s site for more information.
  5. New core behaviors: The Remote and Observed behaviors are now included in the core so you can now turn normal links and forms into Ajaxy links and forms even more easily.
  6. Event.addBehavior.reassignAfterAjax is now false by default: Normally, if you are relying on this behavior it’s much more efficient to move to a solution using event delegation. However, if you do want your behaviors reassigned to new content after Ajax calls then go ahead and set it back to true again. Another solution is to manually call Event.addBehavior.reload();

So that’s about it. As you can see, it’s getting smaller as Prototype fills the gaps and graduating into more of a pure behavior framework. I’d be interested in adding more core behaviors for other common tasks as well as possibly getting together some kind of behavior library. I know I’m building up a fair few and I’d love to see what everyone else is doing (in fact I’ve already seen some great stuff) so suggestions are more than welcome…as are bug reports and patches. For both of these and general assistance try the Google Group.

Grab the new version and have a play.

13 Comments (Closed)

Sweet! I’ve been waiting on pins and needles for this, as I wanted to upgrade to 1.6, but couldn’t. Awesome work, as usual.

Tim ConnorTim Connor at 12.12.07 / 01AM

Mmmm … was looking forward to this post for a long time.

Thanks Dan!

Morgan RoderickMorgan Roderick at 12.12.07 / 09AM

“Low Pro’s DOM methods are now gone: Prototype core does everything you should need now.”

Yess, the good news of the day for me !

Thanks

PlopPlop at 12.12.07 / 11AM

Awesome news, thanks for the update!

EricEric at 12.12.07 / 21PM

Hell, it´s about time! ;) Great work, Dan

Nicolás SanguinettiNicolás Sanguinetti at 12.12.07 / 21PM

Great!

However, with the newest version I tried to do a simple Remote.Link with:

Event.addBehavior({ “div.pagination a” : Remote.Link });

On the first click on my links it works as expected and remotes the link and doesnt refresh the page only the div. On the second instance it goes to the link and refreshes the page. Same code, version 0.4.1 works just fine. Also, I am using the most recent version of prototype (1.6.0.1).

Peter

PeterPeter at 13.12.07 / 17PM

Hi,

Referring to (6), when you say "it’s much more efficient to move to a solution using event delegation", do you mean something similar to http://www.danwebb.net/2007/7/18/low-pro-behaviours-101-part-2 under "Event delegation with behaviours" ?
I just want to confirm before reimplementing it that way to test the efficiency difference.
Thanks.

-Nash

NashNash at 14.12.07 / 04AM

Awesome news, thanks for the update!

LampenLampen at 25.12.07 / 13PM

Nice, I will try it. Amazing layout!

Evandro.NetEvandro.Net at 26.12.07 / 23PM

I was wondering how you would do the following with lowpro 0.5? This seems to have been in earlier versions of lowpro, but looks like it was taken out.

Event.trigger(element, ‘click’);

ChrisChris at 07.01.08 / 16PM

Thanks for very interesting article. btw. I really enjoyed reading of your posts. It’s interesting to read ideas, and observations from someone else’s point of view… makes you think more. Greetings.

PlisseePlissee at 22.01.08 / 01AM

@Chris: http://prototypejs.org/api/element/fire

KniaźKniaź at 03.02.08 / 15PM

@Kniaź: But this fires only custom events. It can not handle native DOM events! With Event.trigger(element, eventName); it was also able to fire DOM events…

SamirSamir at 12.02.08 / 09AM

About This Article