Closed Bug 1818245 Opened 2 years ago Closed 2 years ago

Consolidate dynamic attribute setting code in UrlbarView

Categories

(Firefox :: Address Bar, task)

task

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: dao, Assigned: dao)

References

(Blocks 1 open bug)

Details

(Whiteboard: [snt-urlbar-result-menu])

Attachments

(1 file)

In bug 1813517 I added another case where we take an attributes property to set arbitrary attributes on an element. We should consolidate and share this code with other places doing the same thing, thereby fixing a few shortcomings:

  • properly set boolean attributes as foo=""/[attribute absent] instead of foo="true"/foo="false"
  • avoid creating and iterating over a dummy object in case the attribute property isn't set
  • don't override previously set-via-classList classes when setting the class attribute
  • remove the attribute when the value is undefined (current === null check is too strict)

In bug 1813517 I added another case where we take an attributes property to set arbitrary attributes on an element. We should consolidate and share this code with other places doing the same thing, thereby fixing a few shortcomings:

  • properly set boolean attributes as foo=""/[attribute absent] instead of foo="true"/foo="false"
  • avoid creating and iterating over a dummy object in case the attribute property isn't set
  • don't override previously set-via-classList classes when setting the class attribute
  • remove the attribute when the value is undefined (current === null check is too strict)
Pushed by dgottwald@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e37f5cc3f9e9 Consolidate dynamic attribute setting code in UrlbarView. r=adw
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: