atomicojs / atomico

Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.
https://atomicojs.dev
MIT License
1.16k stars 43 forks source link

Code that never execute #21

Closed A-owl closed 4 years ago

A-owl commented 4 years ago

https://github.com/atomicojs/atomico/blob/master/src/core/element/element.js#L171

customElements.define(
  nodeType,
  component instanceof Element ? component : customElement(component)
);

component instanceof Element never will be true. component is a constructor , not a instance.

suggest:

customElements.define(
  nodeType,
  customElement(component)
);
UpperCod commented 4 years ago

Thanks for the observation and contribution, I generated the change in version 0.15.1 and added some additional comments to the code for better reading https://github.com/atomicojs/atomico/blob/master/src/core/element/element.js#L169