DrSensor / nusa

incremental runtime that bring both simplicity and power into webdev (buildless, cross-language, data-driven)
MIT License
4 stars 0 forks source link

Only call constructor after host children moved into shadowroot #11

Closed DrSensor closed 1 year ago

DrSensor commented 2 years ago

Constructing the class while traversing list of pre-import(script.src) promise is wrong. This make some logic that involve slot attribute being buggy. All class module should be instantiated at the same time right after shadow.append(...host.children). It also prevent some unknown ES modules to traverse element outside the host.

Note when wait attributes #6 detected, it will inject :root { display: none } into shadow root style sheet and remove that style rule when all waited classes instantiated.