Open Bug 818534 Opened 13 years ago Updated 3 years ago

Replace repetitive element getters with something cleaner.

Categories

(Firefox :: Downloads Panel, defect)

x86
All
defect

Tracking

()

People

(Reporter: mconley, Unassigned)

Details

In the front-end code for the downloads panel, we have some repetitive getters that retrieve / memoize DOM elements. Example: /** * Sets whether or not the Downloads Summary should be displayed in the * footer. If not, the "Show All Downloads" button is shown instead. */ set showingSummary(aValue) { if (this._footerNode) { if (aValue) { this._footerNode.setAttribute("showingsummary", "true"); } else { this._footerNode.removeAttribute("showingsummary"); } } return aValue; }, /** * Element corresponding to the footer of the downloads panel. */ get _footerNode() { let node = document.getElementById("downloadsFooter"); if (!node) { return null; } delete this._footerNode; return this._footerNode = node; } We can probably do something a bit cleaner with a centralized _element function and a WeakMap.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.