diff --git a/src/browser/tests/document/get_elements_by_tag_name.html b/src/browser/tests/document/get_elements_by_tag_name.html index 283953f1..89ab1470 100644 --- a/src/browser/tests/document/get_elements_by_tag_name.html +++ b/src/browser/tests/document/get_elements_by_tag_name.html @@ -153,3 +153,11 @@ } + diff --git a/src/browser/webapi/collections/node_live.zig b/src/browser/webapi/collections/node_live.zig index 68ca3b73..5e5f084d 100644 --- a/src/browser/webapi/collections/node_live.zig +++ b/src/browser/webapi/collections/node_live.zig @@ -114,8 +114,11 @@ pub fn NodeLive(comptime mode: Mode) type { if (self._last_length) |cached_length| { return cached_length; } + // not ideal, but this can happen if list[x] is called followed + // by list.length. + self._tw.reset(); + self._last_index = 0; } - // If we're here, it means it's either the first time we're called // or the DOM version has changed. Either way, the _tw should be // at the start position. It's important that self._last_index == 0