Skip to content

Commit 4c89bb0

Browse files
committed
Improve MutationObserver
- Fix get_removedNodes (it was returning addedNodes) - get_removedNodes and get addedNodes now return references - used enum for dispatching and clean up dispatching in general - Remove MutationRecords and simply return an array - this allows the returned records to be iterable (as they should be) - jsruntime ZigToJs will now map a Zig array to a JS array -Rely on default initialize of NodeList -Batch observed records - Callback only executed when call_depth == 0 - Fixes crashes when a MutationObserver callback mutated the nodes being observes. - Fixes some WPT issues, but Netsurf's mutationEventRelatedNode does not appear to be to spec, so most tests fail. - Allow zig methods to execute arbitrary code when call_depth == 0 - This is a preview of how I hope to make XHR not crash if the CDP session ends while there's still network activity
1 parent 332508f commit 4c89bb0

File tree

7 files changed

+264
-462
lines changed

7 files changed

+264
-462
lines changed

src/browser/dom/css.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const MatchAll = struct {
4949
fn init(alloc: std.mem.Allocator) MatchAll {
5050
return .{
5151
.alloc = alloc,
52-
.nl = NodeList.init(),
52+
.nl = .{},
5353
};
5454
}
5555

@@ -62,7 +62,8 @@ const MatchAll = struct {
6262
}
6363

6464
fn toOwnedList(m: *MatchAll) NodeList {
65-
defer m.nl = NodeList.init();
65+
// reset it.
66+
defer m.nl = .{};
6667
return m.nl;
6768
}
6869
};

0 commit comments

Comments
 (0)