Thanks! I was assuming callbacks would get some special treatment, especially 'created'. Now it certainly makes sense to provide some flexibility to the user.
Julien 2014-02-17 15:16 GMT-03:00 Scott Miles <[email protected]>: > > callbacks from super elements are not called when overridden > > This is normal for JavaScript inheritance chains. Any method (including > callbacks) resolves to the most-derived (subclass) implementation. The > subclass gets the choice of when/how/if to call a superclass method. > > I.e., if x-foo has a method 'doStuff', and x-bar extends x-foo, then x-bar > can override doStuff and: > > - completely redefine doStuff behavior by reimplementing and never > calling x-foo.prototype.doStuff > - do some work, then call this.super() to get the default behavior, > then do more work > - capture the return value of this.super() and modify or act on it > - control arguments sent to x-foo implementation via this.super() > (note that super takes an _array_ of pass-through arguments as a parameter, > e.g. `this.super(arguments)` or `this.super([a, 3, null])) > > If you automate calling super-class methods, you lose all the flexibility > above. This is why we jump through several hoops to provide `this.super` > method. > > > On Mon, Feb 17, 2014 at 6:01 AM, Julien Eluard <[email protected]>wrote: > >> Hi, >> >> testing the 'extends' feature I was surprised to see that callbacks from >> super elements are not called when overridden. Super callbacks are called >> when no overrides are provided. Note that calling this.super() does what is >> expected (see here: http://jsfiddle.net/29btP/) >> I had a similar behavior when testing directly with Custom Element. >> >> Is that expected? I find it a little counterintuitive. >> >> Thanks, >> Julien >> >> Follow Polymer on Google+: plus.google.com/107187849809354688692 >> --- >> You received this message because you are subscribed to the Google Groups >> "Polymer" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/polymer-dev/a94807a6-88c5-480d-b2d1-be3c6ee290f2%40googlegroups.com >> . >> For more options, visit https://groups.google.com/groups/opt_out. >> > > Follow Polymer on Google+: plus.google.com/107187849809354688692 --- You received this message because you are subscribed to the Google Groups "Polymer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CAKteE7NfQpkDaR-Pcss2NtKKjDDu%3DPj_yhRtGBpVjKsxGe5XVw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
