Come up with a more consistent pattern for inheriting attributes for MozElement Custom Elements
Categories
(Toolkit :: UI Widgets, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: bgrins, Assigned: bgrins)
References
Details
Attachments
(2 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
13.92 KB,
patch
|
Details | Diff | Splinter Review |
Previous discussions about this can be seen in Bug 1502947 and Bug 1523429 and in the reviews of the patches there.
Current inheritAttribute helper: https://searchfox.org/mozilla-central/rev/cb7faaf6b4ad2528390186f1ce64618dea71031e/toolkit/content/customElements.js#63
Some examples of how we do this currently:
- Explicit (<menulist>): https://searchfox.org/mozilla-central/rev/cb7faaf6b4ad2528390186f1ce64618dea71031e/toolkit/content/widgets/menulist.js#376
- Map + explicit (autocomplete <richlistitem>): https://searchfox.org/mozilla-central/source/toolkit/content/widgets/autocomplete-richlistitem.js#82-114
- Map + [inherit] attribute (<popupnotification>): https://searchfox.org/mozilla-central/rev/cb7faaf6b4ad2528390186f1ce64618dea71031e/toolkit/content/widgets/popupnotification.js#44-60
-- Note: works for content where we don’t nest more elements underneath that will also set [inherits], otherwise we’ll incorrectly map down to nested children. Wouldn’t be a problem with Shadow DOM
Having some kind of static map with type of <selector, <array<attribute>>
would allow observedAttributes to be read by processing the map instead of having them declared separately. We'd have to sort out when to cache (and invalidate) the results of querySelector.
Assignee | ||
Comment 1•6 years ago
|
||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Comment 2•6 years ago
|
||
Updated•6 years ago
|
Pushed by bgrinstead@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/66082f22ae11 Add MozElement `inheritedAttributes` helper for automatically inheriting attributes based on a map of selectors to attributes r=paolo
Comment 4•6 years ago
|
||
Backed out for merge conflicts on toolkit/content/widgets/popupnotification.js!
Backout link: https://hg.mozilla.org/integration/autoland/rev/79d9076cbaa1c24ca96094e86706952951bb67f6
Assignee | ||
Comment 5•6 years ago
|
||
(In reply to Cosmin Sabou [:CosminS] from comment #4)
Backed out for merge conflicts on toolkit/content/widgets/popupnotification.js!
Backout link: https://hg.mozilla.org/integration/autoland/rev/79d9076cbaa1c24ca96094e86706952951bb67f6
Rebased and relanded
Pushed by bgrinstead@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/27280189b6fa Add MozElement `inheritedAttributes` helper for automatically inheriting attributes based on a map of selectors to attributes r=paolo
Comment 7•6 years ago
|
||
bugherder |
Updated•5 years ago
|
Description
•