[whatwg/dom] Return value for DOMTokenList's replace() (#577)

DOMTokenList's `replace()`-method does not currently have a specified return value. While using it I've needed code which takes different paths depending on whether a successful replacement occurred or not. To find out if this was the case I must currently use separate conditions with `contains()`.

Could `replace(oldToken, newToken)` return a boolean indicating true if oldToken was indeed present and got replaced by newToken? This would help with writing cleaner code, and there's a precent in the `toggle(token)`-method which returns true or false depending on whether the call resulted in the addition or removal of the token.

Given the relatively recent introduction of `replace()`, there's probably a good chance of this change being web compatible.

-- 
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/577

Received on Friday, 23 February 2018 20:30:50 UTC