←back to thread

Element: setHTML() method

(developer.mozilla.org)
170 points todsacerdoti | 7 comments | | HN request time: 1.03s | source | bottom
1. AlienRobot ◴[] No.45675157[source]
Great functionality, terrible name.
replies(3): >>45675224 #>>45675738 #>>45678913 #
2. varun_ch ◴[] No.45675224[source]
I sometimes wonder whether what the DOM APIs could look like in a hypothetical world where we could start over with everything.
replies(1): >>45678939 #
3. jonathrg ◴[] No.45675738[source]
Why? Does it not set the HTML?
replies(1): >>45676209 #
4. netsharc ◴[] No.45676209[source]
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)...

replies(1): >>45677148 #
5. hoppp ◴[] No.45677148{3}[source]
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.

6. hexasquid ◴[] No.45678913[source]
After a minute of digging, found discussion here: https://github.com/WICG/sanitizer-api/issues/100 Perhaps it can be reopened (or a new issue can be opened) regarding naming.
7. hexasquid ◴[] No.45678939[source]
It looks like this isn't a standard yet.