Problem
Code OSS Explorer refresh fails in WebScene with the exact runtime error:
TypeError: e.twistie.classList.item is not a function
The unchanged VS Code tree renderer calls templateData.twistie.classList.item(0) in src/vs/base/browser/ui/tree/abstractTree.ts. WebScene's current DOMTokenList wrapper implements the existing same-object and live mutation slice (add, remove, contains, toggle, and value) but omits the indexed collection surface.
A production-source inventory also finds reachable use of:
classList.item(index) in the shared tree renderer;
- iteration/spread (
[...element.classList]) in sessions/chat UI;
classList.replace(old, next) in chat icon rendering;
classList.length as part of the normal DOM collection contract.
The missing item() call aborts the tree renderer's async update, blocking Explorer content even though the remote extension host and file watcher are connected.
Reproduction
- Run packaged Code OSS on AppScene/WebScene with a real folder workspace.
- Activate Explorer and wait for its asynchronous tree refresh.
- Observe the
DOMTokenList.item TypeError in native runtime diagnostics and an unchanged/empty Explorer presentation.
- Chromium using the same server payload exposes the expected tree.
Proposed implementation
Implement the product-neutral DOMTokenList collection surface in WebScene's native V8 wrapper:
length as a live unsigned count;
item(index) returning the token or null out of range;
- supported indexed property access (
tokens[0]) with live values;
keys(), values(), entries(), forEach(), and Symbol.iterator with Web IDL-compatible order and callback shape;
replace(token, newToken) with correct boolean result, order, duplicate handling, reflected class attribute mutation, recascade, and scene invalidation;
- correct illegal/empty token exceptions shared by all token-taking methods if the existing implementation still lacks them.
Preserve the existing same-object identity and live reflection guarantees. Avoid application-specific branches or a VS Code patch.
Acceptance and gates
- Import or adapt focused upstream DOMTokenList WPTs for
item, indexed getters, length, iterator methods, forEach, replace, and invalid tokens.
- Add a product-neutral async tree-twistie reduction that performs the exact
className = classList.item(0) sequence and proves the following render/update continues.
- Add live-reflection mutation cases for
className, setAttribute, and detach/reconnect.
- Add a bounded benchmark over repeated read iteration and replacement, plus cascade/layout/publication counters to prevent accidental per-read recascade.
- Run the existing Bootstrap/jQuery ecosystem matrix, native/portable WPT subsets, graphics/native contracts, and packaged Code OSS Explorer feature gate.
Integration
Implement as a focused draft PR targeting feature/code-oss-browser-compatibility, then consolidate only after all checks pass. This generic DOM fix belongs in WebScene and should not modify VS Code OSS.
Problem
Code OSS Explorer refresh fails in WebScene with the exact runtime error:
The unchanged VS Code tree renderer calls
templateData.twistie.classList.item(0)insrc/vs/base/browser/ui/tree/abstractTree.ts. WebScene's currentDOMTokenListwrapper implements the existing same-object and live mutation slice (add,remove,contains,toggle, andvalue) but omits the indexed collection surface.A production-source inventory also finds reachable use of:
classList.item(index)in the shared tree renderer;[...element.classList]) in sessions/chat UI;classList.replace(old, next)in chat icon rendering;classList.lengthas part of the normal DOM collection contract.The missing
item()call aborts the tree renderer's async update, blocking Explorer content even though the remote extension host and file watcher are connected.Reproduction
DOMTokenList.itemTypeError in native runtime diagnostics and an unchanged/empty Explorer presentation.Proposed implementation
Implement the product-neutral DOMTokenList collection surface in WebScene's native V8 wrapper:
lengthas a live unsigned count;item(index)returning the token ornullout of range;tokens[0]) with live values;keys(),values(),entries(),forEach(), andSymbol.iteratorwith Web IDL-compatible order and callback shape;replace(token, newToken)with correct boolean result, order, duplicate handling, reflected class attribute mutation, recascade, and scene invalidation;Preserve the existing same-object identity and live reflection guarantees. Avoid application-specific branches or a VS Code patch.
Acceptance and gates
item, indexed getters, length, iterator methods,forEach,replace, and invalid tokens.className = classList.item(0)sequence and proves the following render/update continues.className,setAttribute, and detach/reconnect.Integration
Implement as a focused draft PR targeting
feature/code-oss-browser-compatibility, then consolidate only after all checks pass. This generic DOM fix belongs in WebScene and should not modify VS Code OSS.