Add a CSS-parsing WebExtensions API
Categories
(WebExtensions :: General, enhancement, P5)
Tracking
(Not tracked)
People
(Reporter: bzbarsky, Unassigned)
References
Details
(Whiteboard: [design-decision-approved])
Reporter | ||
Comment 1•7 years ago
|
||
Reporter | ||
Comment 2•7 years ago
|
||
Comment 3•7 years ago
|
||
Comment 4•7 years ago
|
||
Reporter | ||
Comment 5•7 years ago
|
||
Comment 6•7 years ago
|
||
Comment 7•7 years ago
|
||
Comment 8•7 years ago
|
||
Comment 9•7 years ago
|
||
Reporter | ||
Comment 10•7 years ago
|
||
Updated•7 years ago
|
Comment 11•7 years ago
|
||
Comment 12•7 years ago
|
||
Reporter | ||
Comment 13•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
Updated•6 years ago
|
Comment 14•4 years ago
|
||
I have wrote UserCSSManager that inserts all user styles into all tabs without parsing strings . The reason for not parsing strings and selecting tabs to apply on the JavaScript side is to reduce load and improve speed. However, it stopped working altogether due to Bug 1035091. Currently, I have set layout.css.moz-document.content.enabled to true to prolong the life.
Updated•2 years ago
|
Comment 15•2 years ago
|
||
Rob, constructable stylesheets landed in Firefox 101. Is this bug still necessary?
Comment 16•2 years ago
|
||
I'm marking this bug as WONTFIX because an extension-specific API is unnecessary when there is already a fitting API on the open web platform.
The request from https://bugzilla.mozilla.org/show_bug.cgi?id=1035091#c114 was:
I would very much like, in addons, to have access to a CSS parser that actually parses the CSS that is fed into it and faithfully returns all of the results of that parsing. I am not particularly tied to the “create temporary document, create a style element in there”; that looked like a clever hack, too. A WebExt-exposed function that takes a string of CSS and returns an array of CSSRule would be just fine.
Constructable stylesheets do fit that description. Note that even without the CSSStyleSheet constructor, the requested functionality was already available through a temporary <style>
element (in a suboptimal way).
This API is not exposed to (service) workers. A blanket request to port all of CSSOM to workers is not realistic, but we have a more specific feature request about CSS validation in service workers at bug 1580254. Note that Firefox supports event pages in addition to the (in development) service workers, so extensions that really need such functionality can continue to use them.
Description
•