top | item 45677170

(no title)

sergeykish | 4 months ago

So `.setHTML("<script>...</script>")` does not set HTML?

discuss

order

xp84|4 months ago

Sounds reasonable enough to me. 99.99% of the times you’re in an actual script, if you mean to execute code, you’d just execute it yourself, rather than making a script tag full of code and sticking that tag into a random DOM element. That’s why the default wouldn’t honor the script tag and there’d be an “unsafe” method explicitly named as such to hint you that you’re doing something weird.

amelius|4 months ago

But it breaks an abstraction. Sometimes you just want to take working HTML and insert it into a document. It will be painful if suddenly this does not work, and you have to dig into the documentation to see why.

WA|4 months ago

Neither does

    .innerHTML = "<script>...</script>"