2

I am not using Polymer and I am trying to extend the TemplateElement

class ItemTemplate extends TemplateElement{
  ItemTemplate.created():super.created();
}

and then register it

document.registerElement('item-template', ItemTemplate,extendsTag:'template');

but when i add the following to my html test page

  <template>
    template
  </template>

  <item-template>
    item-template
  </item-template>

in Chromium it outputs

item-template

which means the new element that extends TemplateElement is active and not acting as a template, any idea why?

E:this is not a duplicate i said i am not using polymer and there is no polymer in the tags and its specifically about the behavior of the html5 TemplateElement

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
user1492051
  • 886
  • 8
  • 22

1 Answers1

1

I have no experience with extending elements without Polymer but I'm pretty sure you still need the `is="xx-yy" attribute like

<template is="item-template">
  item-template
</template is="item-template">

when you're extending a DOM element.

Maybe there are other measurements necessary to make it work but this should at least bring you a step closer (maybe an error message about what's still missing)

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • the is works but i was hoping that i can keep the use the item-template as tag name, seems its not possible – user1492051 Dec 20 '14 at 16:05
  • 1
    If this solves the problem I'm sure there is no way around. This is how custom-elements are defined (which is not Polymer, but Polymer also builds upon it). – Günter Zöchbauer Dec 20 '14 at 17:02