logoalt Hacker News

voxic11yesterday at 1:43 PM4 repliesview on HN

The idea is you wouldn't mix innerHTML and setHTML, you would eliminate all usage of innerHTML and use the new setHTMLUnsafe if you needed the old functionality.


Replies

extraduder_ireyesterday at 2:51 PM

I looked up setHTMLUnsafe on MDN, and it looks like its been in every notable browser since last year.

Good idea to ship that one first, when it's easier to implement and is going to be the unsafe fallback going forward.

show 1 reply
croesyesterday at 2:22 PM

If I need the old functionality why not stick to innerHTML?

show 3 replies
reddaloyesterday at 2:41 PM

You can't rename an existing method. It would break compatibility with existing websites.

post-ityesterday at 2:01 PM

> you would eliminate all usage of innerHTML

The mythical refactor where all deprecated code is replaced with modern code. I'm not sure it has ever happened.

I don't have an alternative of course, adding new methods while keeping the old ones is the only way to edit an append-only standard like the web.

show 5 replies