Saturday, December 13, 2008

Rails Plugin developers: *PLEASE* don't use Prototype's $() syntax in your plugins!

One of the very first things I like to do when starting a project from scratch in Rails is to throw out Prototype and bring in jQuery via jRails. Look, I love me some Rails, but I hate me some Prototype -- it's like someone spilled their goddamn Java over my sparkling Ruby somehow.

Not cool, man.

Anyway, the thrust of this post is about not using Prototype's shorthand syntax when developing plugins that include UI elements. I name no names, but a few plugins take for granted that you'll be using Prototype throughout your project, and so use $() with reckless abandon. That's fine and all except when you're not using Prototype everywhere, and are trying to use jQuery's sweet ass $() shorthand instead.

I realize that jQuery comes with a no-conflict mode for situations like this, but it'd be cooler if plugins kept themselves as abstract as possible, or just stuck to Rails Javascript generating code instead.

No comments: