Auto merge of #21074 - jonathanKingston:toggle-attribute, r=Manishearth

Implement support for Element.toggleAttribute

Copy implementation following from [Firefox implementation](https://bugzilla.mozilla.org/show_bug.cgi?id=1469592) of soon to be standardised [Element.toggleAttribute](https://github.com/whatwg/dom/pull/656). [Other implementers agreed to ship](https://github.com/whatwg/dom/issues/461)

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes don't fix an issue however the wpt-tests will merge soon and will cause an issue etc.

<!-- Either: -->
- [X] There are tests for these changes **(coming soon in wpt from Firefox and I tested them on this patch)**

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21074)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-06-21 03:54:23 -04:00 committed by GitHub
commit 388a6f80ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

View file

@ -41,6 +41,8 @@ interface Element : Node {
[Pure]
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions, Throws]
boolean toggleAttribute(DOMString name, optional boolean force);
[CEReactions, Throws]
void setAttribute(DOMString name, DOMString value);
[CEReactions, Throws]
void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);