开发者

JavaScript inheritance JQuery vs Prototype DOM Extension

I am not trying 开发者_StackOverflow中文版to ask another JQuery vs. Prototype vs... topic as I have already read 5+ of those on these forums and have been able to gain a lot of knowledge from them. My question is more directly related to wanting the ability to use inheritance for basic classes and not actually sure what would be a good choice.

To be brief, I have the requirement to be able to control theoretical objects in javascript and manipulate them based on user input then display them.

I have used JQuery and enjoy how easy it is to modify the DOM (which appears to be it's main goal). However from all the readings I have done, it seems that JQuery has no intention of assisting you in dealing with classes, inheritance etc. If I have already chosen JQuery to display and manipulate the data what would be a good choice to assist me with the inheritance issue.

My first thought was Mootools or Prototype, however prototype DOM Extension seems to be a very bad approach and would rather wait for Prototype 2.0 unless this isn't an issue on commonly supported browsers now.

I had also read about Base2, Joose, and JS.Class, but don't know if they will do what I am hoping for either. Any suggestions based on the above information would be great, again, I am not trying to figure out the pro's and con's of the commonly used JS frameworks.


Why emulate classical inheritance?

What's wrong with functions and .prototype?

var SomeObject = function(data) {
    this.data = data;
}

SomeObject.prototype.doStuff = function() {
    return this.data;
}

Do it the old fashioned way.

If you want to use anything besides jQuery I would recommend underscore for it's syntactic sugar.

If you must emulate classical OO, I would recommend oorja as it's the lesser of evils.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜