ryansolid / dom-expressions

A Fine-Grained Runtime for Performant DOM Rendering
MIT License
885 stars 127 forks source link

fix runtime error on empty style/script tags #169

Closed trusktr closed 2 years ago

trusktr commented 2 years ago

There was previously a runtime error on empty script/style tags here, because firstChild was null in those cases, but the type cast assumed it to be non-null and a non-null assertion was being used on a null value. Now the type is casted to nullable, and an optional-chaining operator is used instead of non-null assertion to catch the null case.