logoalt Hacker News

mg • today at 8:49 AM • 1 reply • view on HN

> If you interpolate it, you have to escape manually

Well, for some definition of "manually".

If you have untrusted variables to interpolate, you can do

    this.innerHTML = html`Hello ${name}!`
Where html is a function that escapes the variables.

The arguments brought forward against web components all seem to fall under "But it does not contain every functionality you want to use out of the box". Personally, I don't think browsers should provide more and more functionality, but rather a good base to build upon.


Replies

pwdisswordfishq • today at 10:31 AM

Oh great, so where does DOM provide that function?

➕ show 1 reply