css: CSSStyleSheet.replace() should resolve to the stylesheet

This commit is contained in:
Adrià Arrufat committed 2026-03-14 20:30:00 +09:00
1 parent 66a86541d1
commit 55a9976d46
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -492,7 +492,8 @@
let replacedAsync = false;
testing.async(async () => {
await sheet.replace('.async-test { margin: 10px; }');
const result = await sheet.replace('.async-test { margin: 10px; }');
testing.expectTrue(result === sheet);
testing.expectEqual(1, sheet.cssRules.length);
testing.expectEqual('.async-test', sheet.cssRules[0].selectorText);
replacedAsync = true;
+1 -1
View File
@@ -79,7 +79,7 @@ pub fn deleteRule(self: *CSSStyleSheet, index: u32, page: *Page) !void {
pub fn replace(self: *CSSStyleSheet, text: []const u8, page: *Page) !js.Promise {
try self.replaceSync(text, page);
return page.js.local.?.resolvePromise({});
return page.js.local.?.resolvePromise(self);
}
pub fn replaceSync(self: *CSSStyleSheet, text: []const u8, page: *Page) !void {