Skip to content

Can't extend from custom element #156

Description

@admosity

I am trying to extend a simple custom element using version 1.5.9:

xtag.register('x-span', {
  mixins: ['dataPoint', 'dataSource'],
  content: '<span></span>',
  methods: {
    render() {
      // some render logic...
    },
  },
});
xtag.register('x-money-span', {
  extends: 'x-span',
  methods: {
    render() {
      const span = xtag.queryChildren(this, 'span')[0];
      let data = this.data;
      let currency = this.getAttribute('currency');
      if (currency) {
        span.textContent = `${SomeDataService.getData('currency')[currency].symbol}${this.data}`;
      }
    },
  },
});

However, I am getting the following error:

Uncaught NotSupportedError: Failed to execute 'registerElement' on 'Document': Registration failed for type 'x-money-span'. The tag name specified in 'extends' is a custom element name. Use inheritance instead.

😢

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions