Closed
Bug 1359780
Opened 8 years ago
Closed 7 years ago
Update DOMTokenList for spec changes
Categories
(Core :: DOM: Core & HTML, enhancement)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
INVALID
People
(Reporter: ayg, Assigned: ayg)
References
Details
Attachments
(1 file)
59 bytes,
text/x-review-board-request
|
Details |
https://github.com/whatwg/dom/pull/444
There's only one change relevant to us: .toggle() and .replace() always remove duplicates and whitespace from the DOM attribute, even if they're no-ops. This matches .add() and .remove(), and sometimes .replace(). Per spec, .replace() used to rewrite the attribute if you replaced a token with itself, but not if the token to replace isn't in the set.
Comment hidden (mozreview-request) |
Assignee | ||
Updated•8 years ago
|
Attachment #8861918 -
Flags: review?(michael)
Assignee | ||
Updated•8 years ago
|
Attachment #8861918 -
Flags: review?(michael) → review?(masayuki)
Comment 2•8 years ago
|
||
mozreview-review |
Comment on attachment 8861918 [details]
Bug 1359780 - Always remove duplicates/whitespace in DOMTokenList methods
https://reviewboard.mozilla.org/r/133932/#review136816
::: dom/base/nsDOMTokenList.cpp:305
(Diff revision 1)
> (*tokens.AppendElement()).Rebind(aToken.Data(), aToken.Length());
>
> - if (isPresent) {
> + if (isPresent && !forceOn) {
> - if (!forceOn) {
> - RemoveInternal(attr, tokens);
> + RemoveInternal(attr, tokens);
> - isPresent = false;
> + isPresent = false;
I think that use |return false;| is simpler.
::: dom/base/nsDOMTokenList.cpp:306
(Diff revision 1)
>
> - if (isPresent) {
> + if (isPresent && !forceOn) {
> - if (!forceOn) {
> - RemoveInternal(attr, tokens);
> + RemoveInternal(attr, tokens);
> - isPresent = false;
> + isPresent = false;
> - }
> + } else if (!isPresent && !forceOff) {
Then, this can be |if (!isPresent && !forceOff) {| (ommitting else).
::: dom/base/nsDOMTokenList.cpp:308
(Diff revision 1)
> - isPresent = false;
> + isPresent = false;
> - }
> + } else if (!isPresent && !forceOff) {
> - } else {
> - if (!forceOff) {
> - AddInternal(attr, tokens);
> + AddInternal(attr, tokens);
> - isPresent = true;
> + isPresent = true;
So, this should |return true;|.
::: dom/base/nsDOMTokenList.cpp:309
(Diff revision 1)
> - }
> + } else if (!isPresent && !forceOff) {
> - } else {
> - if (!forceOff) {
> - AddInternal(attr, tokens);
> + AddInternal(attr, tokens);
> - isPresent = true;
> + isPresent = true;
> + } else if (attr) {
Then,
if (!attr) {
return isPresent;
}
And reduce the following block's indent.
Attachment #8861918 -
Flags: review?(masayuki) → review+
Comment hidden (mozreview-request) |
Assignee | ||
Comment 4•8 years ago
|
||
mozreview-review-reply |
Comment on attachment 8861918 [details]
Bug 1359780 - Always remove duplicates/whitespace in DOMTokenList methods
https://reviewboard.mozilla.org/r/133932/#review136816
> Then,
>
> if (!attr) {
> return isPresent;
> }
>
> And reduce the following block's indent.
We need to return isPresent whether attr is true or false, so the if (attr) { block needs to stay as it is.
Comment hidden (mozreview-request) |
Pushed by ayg@aryeh.name:
https://hg.mozilla.org/integration/autoland/rev/47b53e3d4b27
Always remove duplicates/whitespace in DOMTokenList methods r=masayuki
Comment 7•8 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Comment 8•8 years ago
|
||
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Updated•8 years ago
|
Keywords: leave-open
Updated•8 years ago
|
status-firefox55:
fixed → ---
Target Milestone: mozilla55 → ---
Assignee | ||
Comment 9•7 years ago
|
||
This spec change was reverted: https://github.com/whatwg/dom/issues/451
Status: REOPENED → RESOLVED
Closed: 8 years ago → 7 years ago
Resolution: --- → INVALID
Comment 10•7 years ago
|
||
Removing leave-open keyword from resolved bugs, per :sylvestre.
Keywords: leave-open
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•