Hacker News new | ask | show | jobs
by jonathrg 240 days ago
Why? Does it not set the HTML?
2 comments

There is already an innerHTML property for elements. This doesn't set the outer HTML, so it's literally setInnerHTML2.
It doesn't say "There's a lot of hidden sanitizing stuff inside this method" from the name...

Something like "setSafeHTML()" would be preferable. (Since it's Mozilla, there should be a few committee meetings to come up with the appropriate name)...

Well ,could it be safelySetHTML instead of setSafeHTML ?

The second one could imply the HTML is already safe while the first one is safe way to set html.

If it's just setHTML then it could imply that don't care if its safe or not.