-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return value for DOMTokenList's replace() #577
Comments
I like that. Copying @wycats who advocated for this feature to see if he agrees. |
Zirro
added a commit
to Zirro/dom
that referenced
this issue
Mar 4, 2018
The replace() method returns true if token was replaced with newToken, and false otherwise. Fixes whatwg#577.
I've opened #582 with an initial take of the spec changes, while awaiting more feedback here. |
Zirro
added a commit
to Zirro/dom
that referenced
this issue
Mar 7, 2018
The replace() method returns true if token was replaced with newToken, and false otherwise. Fixes whatwg#577.
Zirro
added a commit
to Zirro/web-platform-tests
that referenced
this issue
Mar 8, 2018
annevk
pushed a commit
that referenced
this issue
Mar 12, 2018
The replace() method returns true if token was replaced with newToken, and false otherwise. Tests: web-platform-tests/wpt#9920. Fixes #577.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DOMTokenList's
replace()
method does not currently have a specified return value. While using it I've had code which takes different paths depending on whether a replacement occurred or not. To find out if this was the case I must currently use separate conditions withcontains()
.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 some precedent in thetoggle(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 that this change is web compatible.The text was updated successfully, but these errors were encountered: