News for hackers. Stuff that matters.
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by Vinnl on Tuesday February 24, 2026 @09:18AM (#47137463)
I kinda like the way JS evolved into a modern language, where essentially ~everyone uses a linter that e.g. prevents the use of `var`. Sure, it's technically still in the language, but it's almost never used anymore.

(Assuming transpilers have stopped outputting it, which I'm not confident about.)

Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by delaminator on Tuesday February 24, 2026 @09:36AM (#47137690)
for some values of "everyone" and "never".
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by thunderfork on Tuesday February 24, 2026 @09:33AM (#47137651)
Depending on the transpiler and mode of operation, `var` is sometimes emitted.

For example, esbuild will emit var when targeting ESM, for performance and minification reasons. Because ESM has its own inherent scope barrier, this is fine, but it won't apply the same optimizations when targeting (e.g.) IIFE, because it's not fine in that context.

https://github.com/evanw/esbuild/issues/1301

Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by yawaramin on Tuesday February 24, 2026 @01:37PM (#47140815)
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by Vinnl on Tuesday February 24, 2026 @01:56PM (#47141063)
Ah yeah, I remember that. General point still stands: in terms of the lived experience of developers, `var` is essentially deprecated.
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by plorkyeran on Tuesday February 24, 2026 @03:11PM (#47142238)
I touch JS that uses var heavily on a daily basis and I would be incredibly surprised to find out that I am alone in that.
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by Vinnl on Wednesday February 25, 2026 @04:55AM (#47149532)
That is indeed why I added qualifiers to "everyone" and "never".