From 1576aac89ff4e568573906cd9ecddbf720909793 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 12:56:24 -0800 Subject: [PATCH] Scripts: compound path pathItems.index(n) reads the members `PathItems.index()` with a number went straight to `items_doc`, which refuses every compound-path-scoped `PathItems` so that creating paths there stays unavailable. Its siblings (`[n]`, `getByName`, `length`, `removeAll`) already dispatch scoped collections to the layer handlers first, but `index` did not, so `compoundPathItems[0].pathItems.index(0)` threw "creating paths in a compound path is not available yet". Route a scoped `index` to `scoped_index` like the other lookups; the guard now only stops real creation. --- crates/engine/src/script/dom/paths.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/engine/src/script/dom/paths.rs b/crates/engine/src/script/dom/paths.rs index ae2fcda50a..4ac860ebee 100644 --- a/crates/engine/src/script/dom/paths.rs +++ b/crates/engine/src/script/dom/paths.rs @@ -477,6 +477,9 @@ fn items_named(h: &super::Host, doc: Doc, name: &str) -> Answer { } fn items_index(h: &super::Host, a: &[Data]) -> Answer { + if super::layers::is_scoped(a, "PathItems") { + return super::layers::scoped_index(h, a); + } match arg(a, 1) { Data::String(_) => items_by_name(h, a), Data::Number(n) => {