xbtsw
xbtsw

Reputation: 734

`is` attribute to initialize polymer component

We know from the core-input documentation that core-input is supposed to be used in this way:

<input is="core-input">

This way of using is attribute to initialize a polymer component seems not documented anywhere. Could anyone pointing me to the relevant documentation?

Upvotes: 2

Views: 128

Answers (1)

Ross Allen
Ross Allen

Reputation: 44890

is is the attribute for native type extension as defined in the W3C spec and is not specific to Polymer. In order to use the is attribute, the custom element must extend the appropriate native element's prototype.

document.registerElement('x-foo', {
  prototype: Object.create(HTMLParagraphElement.prototype, {}),
  extends: 'p'
});

...

<p is="x-foo"></p>

Polymer 0.5 enables this type extension with the extends attribute:

<polymer-element name="x-foo" extends="p">
  ...
</polymer-element>

...

<p is="x-foo"></p>

Upvotes: 4

Related Questions