1

I recently asked How to extend multiple elements with Polymer and it turned out, in fact, you can't really. The idea was to create a web component that can be applied to different elements to "decorate" them.

Addy Osmani answered this question with a few approaches to handle that use case.

One of them was:

The alternative (if you strictly want to do this all in one custom element, which imo, makes this less clean) is to do something like checking against the type of element being extended, which could either be done in the manner you linked to or by checking as part of your element registration process.

Despite from fact that this approach might be less clean, my question is:

How I can find out what element is going to be extended while I'm registering my own?

Community
  • 1
  • 1
Pascal Precht
  • 8,803
  • 7
  • 41
  • 53
  • Your question is a bit confusing. When you register an element, you must specifically indicate to Polymer if you are extending another element. IOW, you must be in possession of that information at the start. Seems like you are asking, if I call `foo(3)`, how do I know what value I passed to `foo`. I'm sure it's not that simple, but I think we need more details to provide an answer. – Scott Miles Jun 14 '14 at 23:41
  • Well this question is based on Addy's answer to the other question. All information is there. I'm probably as confused as you are I just try to understand what Addy meant. Maybe he can answer this question since he's the one who left that comment. – Pascal Precht Jun 15 '14 at 08:49
  • You asked this question: "How I can find out what element is going to be extended while I'm registering my own?". The direct answer is "You already must know what element you are extending in order to register an extension". – Scott Miles Jun 18 '14 at 22:49

0 Answers0