Open
Bug 1231347
Opened 9 years ago
Updated 2 years ago
Don't parse stylesheet to get theme variables in theme.js, use computed styles instead
Categories
(DevTools :: General, defect)
DevTools
General
Tracking
(Not tracked)
NEW
People
(Reporter: pbro, Unassigned)
Details
In /devtools/client/shared/theme.js, we expose an API to javascript that allows consumers to retrieves values of theme variables defined in our CSS variables file. To do this, we load the CSS file from disk and parse it. This bug is about changing this to use computed styles instead. For example, if you have a reference to any toolbox document object, you could list all variables doing this: var style = getComputedStyle(doc.documentElement); for(var i = 0; i < style.length; i ++) { if (style[i].substring(0, 2) === "--") { var name = style[i]; var value = style.getPropertyValue(style[i])); } } If we do this though, we'd have to change all consumers of this API to make sure they pass a reference to a document.
Reporter | ||
Comment 1•9 years ago
|
||
Also, it'd be great if we could use this same API to retrieve CSS variables defined in other CSS files (like in the animation-inspector, we have a few CSS variables defined and it'd be nice to be able to retrieve them too).
Updated•6 years ago
|
Product: Firefox → DevTools
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•