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.
There was previously a runtime error on empty script/style tags here, because
firstChild
wasnull
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 thenull
case.