Ah okay, so you can use "Parent.prototype.method.call()" as an alternative
for the $super argument?

Would that be better to use for performance critical apps instead of the
$super argument?

On Mon, Nov 29, 2010 at 8:03 PM, T.J. Crowder <t...@crowdersoftware.com>wrote:

> Hi,
>
> From within a call to `SectionText`'s `extension` function, you can
> use `$super` to call `Section`'s version, although be aware that
> Prototype's `$super` support relies on some ugly things under the
> covers (like function decompilation).
>
> There's a clunky alternative which you can use anywhere (including
> within `SectionText`'s `extension` function:
> `Section.prototype.extension.call(instanceReference, ...)`. Here's an
> example:
> http://jsbin.com/iquto5
>
> Or you can go a totally different direction:
> http://blog.niftysnippets.org/2009/09/simple-efficient-supercalls-in.html
>
> Happy coding,
> --
> T.J. Crowder
> Independent Software Engineer
> tj / crowder software / com
> www / crowder software / com
>
> On Nov 29, 4:45 pm, Luke <kickingje...@gmail.com> wrote:
> > Thanks. Fermion in the Prototype-IRC also told me the same thing. But
> > he said you cannot access the parent's property. It will be
> > overwritten by the child. Is that true or do you know any way to
> > access it from the child? $super just seems to contain the parent's
> > method that has the same name like the child's method it is passed
> > to... .
> >
> > On Nov 29, 1:23 pm, Johan Arensman <johanm...@gmail.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > You can use the $super parameter name to access the property of the
> parent
> > > class.
> >
> > > See:http://api.prototypejs.org/language/Class/create/
> >
> > > On Mon, Nov 29, 2010 at 12:15 PM, Luke <kickingje...@gmail.com> wrote:
> > > > Hi there!
> >
> > > > Is there a way you can inherit from a class and extend a property
> from
> > > > the parent class with the same property of the subclass? Like if I
> > > > have the following 2 classes:
> >
> > > > === ===
> >
> > > > var Section = Class.create({
> >
> > > >  attach: function(element) {
> > > >    Object.extend(element, this.extension);
> > > >  }
> >
> > > >  extension: {
> > > >    // Methods and properties here
> > > >  }
> > > > }
> >
> > > > === and ===
> >
> > > > var SectionText = Class.create(Section, {
> >
> > > >  extension: {
> > > >    // More methods and properties here
> > > >  }
> >
> > > > });
> >
> > > > === ===
> >
> > > > is somehow possible to extend the extension-property of the parent
> > > > class with the extension-property of the subclass rather than
> > > > replacing it? Can I maybe somehow access the parent's property from
> > > > the subclass to manually extend it?
> >
> > > > Thanks,
> > > > Luke
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> Groups
> > > > "Prototype & script.aculo.us" group.
> > > > To post to this group, send email to
> > > > prototype-scriptacul...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > prototype-scriptaculous+unsubscr...@googlegroups.com<prototype-scriptaculous%2bunsubscr...@googlegroups.com><prototype-scriptaculou
> s%2bunsubscr...@googlegroups.com <s%252bunsubscr...@googlegroups.com>>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com<prototype-scriptaculous%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to