Luke,
At FanBoom, we are moving from prototype to jQuery too! jQuery is just much lighter and easier to use than the clunky prototype. Nice post, its very helpful. Will bookmark this!
A lot of work with javascript here, but keep in mind that some (many?) of us end users expect (demand?) web pages to function simply as documents. Furthermore, much of what’s done with javascript can be accomplished with plain dhtml, avoiding processing and security glitches.
The single most popular add-on for Firefox is NoScript.
@Esekla — I hear what you’re saying. I’m a big proponent of progressive enhancement, which means that a website functions fine without javascript, and functions even better when javascript is available.
The stats are that 95% of web users have javascript enabled.
One note: “DHTML” includes the use of javascript — perhaps you meant much of what’s done with Javascript can be accomplished with HTML + CSS, in which case I agree, and that’s certainly my first choice when it’s available. But there is a ton of fun, useful features that Javascript makes possible, and offering 95% of your users an easier, more enjoyable experience is a great reason to employ a javascript framework like jQuery.
i know you’re not looking for help with Prototype as you’re switching to jQuery, but it is slightly misleading to show the ‘before’ as Prototype code — it wasn’t using Prototype at all. FWIW, here’s how you could’ve written it using Prototype 1.6:
everyone guess what
the author of this article basically doesn’t know what he is talking about
his examples are regular JS and not prototype
also he misunderstands that unlike jquery, in prototype you can still opt to use the actual language based methods, unlike jQ which has recoded the same functionality that is in js /the jquery way/ whatever that means.
Don’t ever forget, you use jQ because you are too lame to be bothered to learn how to actually code, not because jQ is in some way a “better” framework.
@justin: I think that’s a good point. Thanks for sharing the example code.
@troll: you make the same point as justin made months ago, but manage to do it an obnoxious, disrespectful way with no code examples. Guess that’s why you didn’t leave your real name…
Nice article!
I am struggling with converting a script over to jquery from prototype, i cannot understand what should be done with classes.
The code starts with:
var chatChannel = Class.create();
chatChannel.prototype = {
initialize: function(channel) {
…
The script is on: http://www.chabotc.com/javascript/webchat-20-first-release/ (not sure why you’d need that but just in case!).
Any help would be massively appreciated!
May 20th, 2008 at 5:35 am
Luke,
At FanBoom, we are moving from prototype to jQuery too! jQuery is just much lighter and easier to use than the clunky prototype. Nice post, its very helpful. Will bookmark this!
June 2nd, 2008 at 4:07 pm
A lot of work with javascript here, but keep in mind that some (many?) of us end users expect (demand?) web pages to function simply as documents. Furthermore, much of what’s done with javascript can be accomplished with plain dhtml, avoiding processing and security glitches.
The single most popular add-on for Firefox is NoScript.
July 2nd, 2008 at 9:21 pm
@Esekla — I hear what you’re saying. I’m a big proponent of progressive enhancement, which means that a website functions fine without javascript, and functions even better when javascript is available.
The stats are that 95% of web users have javascript enabled.
One note: “DHTML” includes the use of javascript — perhaps you meant much of what’s done with Javascript can be accomplished with HTML + CSS, in which case I agree, and that’s certainly my first choice when it’s available. But there is a ton of fun, useful features that Javascript makes possible, and offering 95% of your users an easier, more enjoyable experience is a great reason to employ a javascript framework like jQuery.
July 2nd, 2008 at 9:35 pm
Nice article. I’ve also written one about migrating from prototype to jquery – maybe you want to check it out:
http://blog.9elements.com/?p=12
July 21st, 2008 at 3:15 am
i know you’re not looking for help with Prototype as you’re switching to jQuery, but it is slightly misleading to show the ‘before’ as Prototype code — it wasn’t using Prototype at all. FWIW, here’s how you could’ve written it using Prototype 1.6:
this._arrow = new Element(‘img’, { ‘src’ : this.settings.arrowImage, ‘class’ : ‘color_picker_arrow’ });
this._arrow.setStyle({ ‘border’ : 0, ‘margin’ : 0, ‘padding’ : 0, ‘position’ : ‘absolute’, ‘top’ : 0, ‘left’ : 0, ‘zIndex’ : 10000 });
document.body.appendChild(this._arrow);
September 10th, 2008 at 2:00 pm
everyone guess what
the author of this article basically doesn’t know what he is talking about
his examples are regular JS and not prototype
also he misunderstands that unlike jquery, in prototype you can still opt to use the actual language based methods, unlike jQ which has recoded the same functionality that is in js /the jquery way/ whatever that means.
Don’t ever forget, you use jQ because you are too lame to be bothered to learn how to actually code, not because jQ is in some way a “better” framework.
December 12th, 2008 at 3:32 pm
@justin: I think that’s a good point. Thanks for sharing the example code.
@troll: you make the same point as justin made months ago, but manage to do it an obnoxious, disrespectful way with no code examples. Guess that’s why you didn’t leave your real name…
December 12th, 2008 at 3:41 pm
[...] Tips for porting javascript from Prototype to [...]
January 11th, 2009 at 4:09 pm
Sometime pure javascript is enough to implement classes in DOM leaving aside jQuery tricks.
December 22nd, 2009 at 8:57 am