Open
Bug 818534
Opened 12 years ago
Updated 2 years ago
Replace repetitive element getters with something cleaner.
Categories
(Firefox :: Downloads Panel, defect)
Tracking
()
NEW
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.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•