we (web engine): Experimental web browser project to understand the limits of Claude

DOM-JS bridge: document object and element access #279

Open pierrelf.com
targeting main
Open opened by and assigned to pierrelf.com
targeting main

Implements issue 3mhyfmgy2qu2i — DOM-JS bridge: document object and element access (Phase 11, issue 2 of 8).

Summary #

  • Adds DomBridge struct holding shared Document and wrapper identity cache (NodeId -> GcRef)
  • Vm::attach_document(doc) registers the document global with structural properties
  • Document properties: documentElement, head, body, title, nodeType
  • Query methods: getElementById, getElementsByTagName, getElementsByClassName, querySelector, querySelectorAll
  • Factory methods: createElement, createTextNode
  • Element wrappers expose tagName, nodeName, nodeType, id, className
  • Wrapper identity: same DOM node always returns the same JS object (=== works)
  • Added NodeId::from_index() to dom crate and Parser::parse_selectors() to css crate
  • 20 new tests covering all acceptance criteria

Test plan #

This pull request has no versions submitted yet.