Skip to content

Web Components support #475

@jcubic

Description

@jcubic

I was trying to create a Web Component in LIPS. But failed. Here is my attempt:

https://codepen.io/jcubic/pen/qENmmKb?editors=1000

I've found the code on StackOverflow:

But the code doesn't work and keeps throwing:

Uncaught TypeError: Failed to construct 'HTMLElement': Illegal constructor

I suspect that the problem is that the class constructor is async, returns a promise.

This code works:

    function HelloElement() {
       console.log('x');
       const ret = make();
       console.log(ret instanceof HTMLElement);
       return ret;
    }
    function make() {
      return Reflect.construct(HTMLElement, [], HelloElement);
    }

But when the code returns Promise.resolve, I've got the same error.

    function HelloElement() {
       console.log('x');
       const ret = make();
       console.log(ret instanceof HTMLElement);
       return Promise.resolve(ret);
    }
    function make() {
      return Reflect.construct(HTMLElement, [], HelloElement);
    }

I need to check the continuation branch; if I remember correctly, I've made all the native sync.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions