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

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