Re: [whatwg/dom] Element.replaceChild should allow for `old, new` argument ordering if `new` is a new element and `old` is a child of Element (#847)

> I don't think it's developer-unfriendly to throw an error if you get argument order wrong. Magically switching the argument order in some cases but not others is not good API design.

Well, I think the spec'd argument order is wrong and we're fixing API design that is already bad... Really, I'd prefer it if we just changed the argument order outright, but I also understand that's not likely to be a realistic option, so I went with the next best thing.

> @gijsk why not convert such code to `a.replaceWith(b)`?

I guess that works. The MDN page wasn't particularly explicit that this existed, and cross-browser support is not amazing (but of course wouldn't improve for changes we introduce to `replaceChild` now).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/847#issuecomment-598340045

Received on Thursday, 12 March 2020 18:05:17 UTC