Skip to content

Expose item(index) on children and childNodes collections #80

Description

@wieslawsoltes

Problem

The packaged Code OSS editor smoke now passes, but its runtime diagnostics show toolbar and action-list failures:

this.actionBar.getContainer(...).firstElementChild?.children.item is not a function
this.actionsList.children.item is not a function

These exceptions prevent some workbench actions and views from updating even though the editor surface is present.

Root cause

WebScene currently returns plain V8 arrays for Element.children and Node.childNodes. The arrays expose numeric indexing and length, but not the DOM collection item(index) contract. WebScene's attribute collection already installs the existing bounded collection_item callback, and the specialized document.links collection has a native item implementation.

Proposed fix

Install the existing collection_item callback on child collections so both children.item(index) and childNodes.item(index) return the indexed wrapper or null when out of range. Add a native V8 regression contract covering element-only filtering, text-node ordering, wrapper identity, and out-of-range results.

A later standards-completeness change can replace snapshot arrays with live HTMLCollection and NodeList wrapper types. This issue's acceptance requires the callable method Code OSS uses while preserving the existing indexed and length behavior.

Acceptance

  • Native V8 contracts pass on all packaged RIDs.
  • Code OSS toolbar/action-list updates no longer throw because children.item is absent.
  • No unbounded allocation or extra tree traversal is added to a collection access.

Activity

  1. wieslawsoltes commented on Sep 15, 2026

    @wieslawsoltes
    CollaboratorAuthor

    Implemented in consolidated PR #76 at 828b6e77d48a1234cf7af44fd8a0efb3767c017b.

    The existing O(1) array lookup callback is installed directly on both returned child collection snapshots. The regression exercises element filtering, text-node tree order, wrapper identity, and null out-of-range results. It adds no extra traversal or allocation beyond the collection snapshot WebScene already produced.

    The current Linux/macOS/Windows native package matrix is validating the change. The next Code OSS artifact run will confirm removal of the toolbar/action-list exceptions.

  2. wieslawsoltes commented on Sep 15, 2026

    @wieslawsoltes
    CollaboratorAuthor

    Validated the NuGet artifact from run 34966346747 at WebScene 828b6e77 in the packaged Code OSS 1.137.0 native app. The editor smoke passed in 5.12 seconds, including create/type/render/undo and clean exit, and neither children.item is not a function diagnostic remains. Manual native launch and editor keyboard input also passed.

    Hosted CI, NativeAOT, native Linux contracts, all three RID package builds, cross-RID evidence, package-set verification, and all installed-package consumer jobs are green at this revision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions