I just wanted to post my reply from your other thread, not sure if you saw it:
To write a class how you like, you could do it like this:
function ajax_request(options){
// initialize
this.setOptions( options );
}
ajax_request.prototype = {
// members and properties
setOptions: function(options){
this.options = options;
}
};
That's the full source code - no extra library or framework required.
I've never understood the fascination with have libraries to take care
of this task for you, when it's so simple to do otherwise.
--John
On 8/11/07, Eridius <[EMAIL PROTECTED]> wrote:
>
>
> Trying to reply with the code i cut out to see if it works, the code is in
> order
>
> 1 => $().click(function(){});
>
> 2 => $().addEvent('click', function(){});
>
> 3 => var ajax_request = function(options)
> {
> ajax_options =
> {
> test: 'test'
> };
>
> test = function()
> {
> alert(this.test);
> }
> }
> var test = new ajax_request();
> test.test();
>
>
> Eridius wrote:
> >
> > I have been working with mootools for a bit the past few months and
> > started to take a look at jQuery too see what the hype is all about from
> > what i have heard from a co-worker. From what i see, jQuery does not
> > offer anything that mootools does not. I mean jQuery does have
> >
> > removed code becuase mailing list does not like it
> >
> > and i don't believe Mootools has anything like that, they just have the:
> >
> > removed code becuase mailing list does not like it
> >
> > However this is just a shortcut and not a major thing. On thing that
> > jQuery has is that there are far more scripts however this is just to the
> > fact that jQuery has been around longer than mootools. However on the
> > other hand mootools has is a very nice way to create new classes. All i
> > have to do is:
> >
> > http://www.apex-wowguild.com/dev/javascript/ajax.js
> >
> > Now I have been told that jQuery tries to do things more like the OO
> > method. Well to me the basically thing about OO is being able to combine
> > members(variables) and methods(functions) into a common
> > place(class/object). I have tried creating a simple class with jQuery and
> > it does not work(this code if based off what i was told from these
> > forums):
> >
> > removed code becuase mailing list does not like it
> >
> > and this code tells me that test() is not a function of test. It seems
> > that jQuery wants you to incorporate everything into the $() selector
> > which does not make sense of everything. Being able create separate
> > object is something that is important to me and jQuery does not seem to
> > support that.
> >
> > Another thing that that jQuery says is that is it so small. Well
> > comparing the full version of mootools(all options selected) to the full
> > version of jQuery is unfair. In order to get allt he features of full
> > mootools you would have to add jQuery interface script and comparing
> > mootools to jQuery&Interface script, mootools is still smaller.
> >
> > So why should someone choose jQuery over Mootools or is it really just a
> > preference thing and and both are basically the same(i see a lot about
> > jQuery vs prototype but not alot about jQuery vs mootools)
> >
>
> --
> View this message in context:
> http://www.nabble.com/Why-jQuery-over-Mootools-tf4254982s15494.html#a12110937
> Sent from the JQuery mailing list archive at Nabble.com.
>
>