All features of NC component loader can be used with any component class if the class provides a constructor.
OR
If the classes registered to the component loader should meet any public interface, that requirement would be documented.
Actual Behaviour
If an observed instance is destroyed, and the component class doesn't expose the HTMLElement as .el, a runtime error throws:
Reproduce Scenario (including but not limited to)
Steps to Reproduce
Have class without public property .el, and register it:
* observe() some part of the DOM
* insert an HTML element with data-nc='MyComponent' inside the observed
* remove the MyComponent HTML element from the DOM
#### Platform and Version
Reproduced in Chrome 126.
NC component loader 0.2.6 (validated it also happens with v1).
#### Sample Code that illustrates the problem
https://jsfiddle.net/tg3cLar2/
#### Logs taken while reproducing problem
Uncaught TypeError: Cannot read properties of undefined (reading 'uuid')
at destroy.js:18:43
at Array.forEach (<anonymous>)
at destroy.js:17:27
at Array.forEach (<anonymous>)
at destroy.js:15:22
Expected Behaviour
All features of NC component loader can be used with any component class if the class provides a constructor. OR If the classes registered to the component loader should meet any public interface, that requirement would be documented.
Actual Behaviour
If an observed instance is destroyed, and the component class doesn't expose the HTMLElement as
.el
, a runtime error throws:Reproduce Scenario (including but not limited to)
Steps to Reproduce
Have class without public property
.el
, and register it:register({ MyComponent });