-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
Description
I am currently implementing the replace() functionality for Constructable StyleSheets in Firefox. I noticed that the specification steps for replace() do not match what is implemented in Chromium.
To be clear, I think that what is implemented in Chromium is more desirable than what is described in the spec, and I think that the spec should be updated to reflect this.
Differences
The sheet keeps the new rules, even if an @import rule fails:
Spec
- In step 5) when an @import rule fails to load, there is no text that says to set the sheet's rules to the new rules, suggesting that the sheet should retain its previous rules.
Actual
- https://jsfiddle.net/enordin/vnzo3809/17/
- The color of the square is black, which is specified in the newest set of rules after the failed @import rule.
- If the previous rules were kept, the color of the square would be yellow.
Other @import rules are loaded, even if one of them fails.
Spec
- In step 5) the spec says, "If any of them [the @import rules] failed to load, terminate fetching of the remaining @import rules..."
Actual
- https://jsfiddle.net/enordin/vnzo3809/24/
- The color of the square is gray, which is specified in the second @import rule.
- If the other @import rule were cancelled, or if the previous rules were kept, the color of the square would be yellow.
Proposed Resolution
I think that the spec text should be modified to convey the following:
- Assign the new rules to the sheet, even if one or more @import rules fail to load.
- Continue with loading other @import rules, even if at least one @import rule fail to load.
This is also consistent with how loading @import rules works in contexts other than Constructable StyleSheets.
Metadata
Metadata
Assignees
Labels
No labels