Skip to content

fix(lynx): emit unquoted nodes-ref attribute selector for native SelectorQuery - #394

Merged
trueadm merged 1 commit into
octanejs:mainfrom
Huxpro:fix/lynx-unquoted-ref-selector
Jul 29, 2026
Merged

trueadm merged 1 commit into
octanejs:mainfrom
Huxpro:fix/lynx-unquoted-ref-selector

Conversation

@Huxpro

@Huxpro Huxpro commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Emit the NodesRef attribute selector without quotes: [octane-ref=r1-h2-g3] instead of [octane-ref="r1-h2-g3"].

Why

  • Native Lynx attribute-selector matching takes the text after = verbatim, quotes included (core/renderer/dom/selector/matching/attribute_selector_matching.cc in lynx-family/lynx: GetSelectorAttrKeyOpValue slices the raw selector string and compares with EQ). The quoted form therefore never matches a native element, and every selector-query operation — invoke, measure, fields, setNativeProps — failed with native code 2 (node not found) on device.
  • Observed on Lynx Explorer 3.9 (iOS): ref.invoke('autoScroll', …) from the Product Gallery tutorial port rejected with Octane Lynx NodesRef invoke failed with native code 2; with this change it scrolls.
  • The token is a plain CSS identifier (r<digits>-h<digits>-g<digits>), so the unquoted form stays valid for DOM querySelector in the JavaScript testing environment — the existing selector-shaped tests pass unchanged.

Changes

  • createLynxNodesRefSelector emits the unquoted form, with a comment pinning the native constraint.

Validation

  • vitest run --project lynx — 259 tests passed
  • tsgo --noEmit -p packages/lynx/tsconfig.json
  • prettier --check on the changed file
  • device evidence: invoke('autoScroll') succeeds on Lynx Explorer 3.9 (iOS) with this change

Risk / follow-ups

  • If a future ref token ever needs non-identifier characters the selector would need escaping instead; today's tokens are digits and dashes only. No changeset: @octanejs/lynx is private.

Note

Medium Risk
Touches the selector string used for all native NodesRef operations; wrong format breaks every selector-query call on device, but the change is narrowly scoped and validated on Lynx Explorer.

Overview
Fixes Lynx selector-query node lookup by changing createLynxNodesRefSelector to emit [octane-ref=r1-h2-g3] instead of a quoted value after =.

Native Lynx attribute matching compares the substring after = literally (quotes included), so the old quoted form never matched elements and invoke, measure, fields, and setNativeProps failed with native code 2 (node not found) on device. Ref tokens are plain CSS identifiers, so the unquoted selector stays valid for DOM querySelector in tests.

Reviewed by Cursor Bugbot for commit d9aebf6. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview Jul 29, 2026 7:40pm
octane-website-mcp Ready Ready Preview Jul 29, 2026 7:40pm

Request Review

@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 29, 2026 19:40 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 29, 2026 19:40 Inactive
@trueadm
trueadm merged commit 131c29a into octanejs:main Jul 29, 2026
24 of 26 checks passed

This branch was previously deployed

2 inactive deployments
Preview – octane-website — d9aebf64 Deployed Jul 29, 2026 by vercel[bot]
Preview – octane-website-mcp — d9aebf64 Deployed Jul 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants