script: Implement CSSStyleSheet.replace (#38244)

Implement `CSSStyleSheet.replace`
[#dom-cssstylesheet-replace](https://drafts.csswg.org/cssom/#dom-cssstylesheet-replace)
with disallow modification flag
[#concept-css-style-sheet-disallow-modification-flag](https://drafts.csswg.org/cssom/#concept-css-style-sheet-disallow-modification-flag).

Basically it would behave like `replaceSync`, but we are running it
asynchronously.

Testing: Existing WPT coverage.
Part of: https://github.com/servo/servo/issues/36162

---------

Signed-off-by: Jo Steven Novaryo <jo.steven.novaryo@huawei.com>
This commit is contained in:
Jo Steven Novaryo 2025-07-25 11:05:22 +08:00 committed by GitHub
parent 928934d4b0
commit 1d896699a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 92 additions and 19 deletions

View file

@ -11,6 +11,8 @@ interface CSSStyleSheet : StyleSheet {
[Throws, SameObject] readonly attribute CSSRuleList cssRules;
[Throws] unsigned long insertRule(DOMString rule, optional unsigned long index = 0);
[Throws] undefined deleteRule(unsigned long index);
[Throws] Promise<CSSStyleSheet> replace(USVString text);
[Throws] undefined replaceSync(USVString text);
};