Closed
Bug 1476873
Opened 7 years ago
Closed 6 years ago
Use Element.toggleAttribute instead of our custom handling for setAttribute vs. removeAttribute
Categories
(Firefox :: WebPayments UI, enhancement, P1)
Firefox
WebPayments UI
Tracking
()
RESOLVED
FIXED
Firefox 66
Tracking | Status | |
---|---|---|
firefox66 | --- | fixed |
People
(Reporter: MattN, Assigned: dpino)
References
()
Details
(Whiteboard: [webpayments-reserve])
Attachments
(1 file, 1 obsolete file)
3.58 KB,
patch
|
MattN
:
review+
|
Details | Diff | Splinter Review |
Assuming that the logic is what we want and won't cause regressions…
https://dxr.mozilla.org/mozilla-central/search?q=regexp%3A%22removeAttribute%5C((key%7Cname)%5C)%22+path%3Apayments&redirect=false
Assignee | ||
Comment 1•6 years ago
|
||
Attachment #9029594 -
Flags: review?(MattN+bmo)
Updated•6 years ago
|
Assignee: nobody → dpino
Status: NEW → ASSIGNED
Priority: P3 → P1
Assignee | ||
Comment 2•6 years ago
|
||
I run the tests. It doesn't seem to be regressions https://treeherder.mozilla.org/#/jobs?repo=try&revision=b3cf25219244e71423a4783c4d14dbcc5357a0b5
Reporter | ||
Comment 3•6 years ago
|
||
Comment on attachment 9029594 [details] [diff] [review]
Bug-1476873-Use-Element.toggleAttribute-instead-of-c.patch
Review of attachment 9029594 [details] [diff] [review]:
-----------------------------------------------------------------
Sorry, I think when I filed this I thought toggleAttribute allowed specifying the value to toggle too, not just the name. Let's only switch to toggleAttribute for boolean attributes like the ones in *-form.js and @changes-prevented then revert the rest.
I don't think the
```js
if (el.toggleAttribute(…)) {
el.setAttribute(…);
}
```
pattern is common enough that I think it hinders readability.
::: browser/components/payments/res/containers/payment-dialog.js
@@ +415,5 @@
> for (let page of this._mainContainer.querySelectorAll(":scope > .page")) {
> page.hidden = state.page.id != page.id;
> }
>
> + this.toggleAttribute("changes-prevented", state.changesPrevented);
This is a good replacement
::: browser/components/payments/res/mixins/ObservedPropertiesMixin.js
@@ +33,5 @@
> get() {
> return this.getAttribute(name);
> },
> set(value) {
> + if (this.toggleAttribute(name, !!value)) {
This is a behaviour change for "" btw.
Attachment #9029594 -
Flags: review?(MattN+bmo) → feedback+
Assignee | ||
Comment 4•6 years ago
|
||
I agree the "if toggle/set" pattern is less readable. Updated patch with suggested changes.
Attachment #9029594 -
Attachment is obsolete: true
Attachment #9031672 -
Flags: review?(MattN+bmo)
Reporter | ||
Comment 5•6 years ago
|
||
Comment on attachment 9031672 [details] [diff] [review]
Bug-1476873-Use-Element.toggleAttribute-instead-of-c.patch
Review of attachment 9031672 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks!
Attachment #9031672 -
Flags: review?(MattN+bmo) → review+
Reporter | ||
Updated•6 years ago
|
Keywords: checkin-needed
Pushed by nerli@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/099c54d22608
Use Element.toggleAttribute instead of custom handling for setAttribute vs. removeAttribute. r=Mattn
Keywords: checkin-needed
Comment 7•6 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox66:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 66
You need to log in
before you can comment on or make changes to this bug.
Description
•