Lynx

DOM

This page documents the DOM CDP domain supported by Lynx DevTool.

Experimental reference

This generated reference is still being completed.

  • CDP events are not included yet.
  • Some Lynx extensions are listed but do not yet have detailed documentation.
  • Method descriptions are not automatically verified against the implementation and may be incomplete or inaccurate.

Verify behavior against the implementation and the linked upstream CDP reference before relying on it.

Overview

  • Scope: instance
  • CDP domain: DOM

Standard Methods

Lynx Extensions

DOM.disableDomTree

Disables Lynx DOM tree capture and reloads the current page.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_dom_agent_ng.cc
Parameters
NameTypeRequiredDescription
ignoreCachebooleanNoWhether the page reload triggered by this method should ignore cache.
Returns

No return fields.

Notes
  • Dispatches through LynxDevToolMediator to InspectorTasmExecutor on the TASM thread.
  • Sets the local Lynx environment flag kLynxEnableDomTree to false.
  • Calls Page.reload with params.ignoreCache. Missing params or a missing ignoreCache field are treated as false.
  • Returns an empty result object after scheduling the reload.
  • If the mediator has no TASM task runner, the current handler does not send an explicit CDP response.
Examples

Disable DOM tree capture and reload

Request:

{
  "id": 1,
  "method": "DOM.disableDomTree",
  "params": {
    "ignoreCache": false
  }
}

Response:

{
  "id": 1,
  "result": {}
}

DOM.enableDomTree

Enables Lynx DOM tree capture and reloads the current page.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_dom_agent_ng.cc
Parameters
NameTypeRequiredDescription
ignoreCachebooleanNoWhether the page reload triggered by this method should ignore cache.
Returns

No return fields.

Notes
  • Dispatches through LynxDevToolMediator to InspectorTasmExecutor on the TASM thread.
  • Sets the local Lynx environment flag kLynxEnableDomTree to true.
  • Calls Page.reload with params.ignoreCache. Missing params or a missing ignoreCache field are treated as false.
  • Returns an empty result object after scheduling the reload.
  • If the mediator has no TASM task runner, the current handler does not send an explicit CDP response.
Examples

Enable DOM tree capture and reload

Request:

{
  "id": 1,
  "method": "DOM.enableDomTree",
  "params": {
    "ignoreCache": true
  }
}

Response:

{
  "id": 1,
  "result": {}
}

DOM.getDocumentWithBoxModel

Returns the Lynx DOM tree with per-node box model data when it can be computed.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_dom_agent_ng.cc
Parameters

No parameters.

Returns
NameTypeDescription
rootobject|stringDOM root object when uncompressed, or a base64-encoded compressed string when result.compress is true.
compressbooleanWhether result.root was zlib-compressed and base64-encoded by the native handler.
root.nodeIdintegerDevTool node id for the Lynx element.
root.backendNodeIdintegerBackend node id. Lynx currently uses the same value as nodeId.
root.nodeTypeintegerDOM node type value reported by ElementInspector.
root.localNamestringLocal element name reported by ElementInspector.
root.nodeNamestringNode name reported by ElementInspector.
root.nodeValuestringNode value reported by ElementInspector.
root.parentIdintegerParent node id when the element has a parent.
root.attributesarrayFlat name/value array containing attributes, data attributes, event attributes, class, style, and selected Lynx inspector metadata.
root.childNodeCountintegerNumber of child nodes serialized for this node.
root.childrenarrayChild nodes serialized with the same shape as root.
root.box_modelobject|nullBox model for this node when Lynx can build and resolve the native layout query. Null when unavailable.
root.box_model.widthnumberElement width after conversion from layout units to pixels.
root.box_model.heightnumberElement height after conversion from layout units to pixels.
root.box_model.contentarrayEight numeric coordinates for the content quad.
root.box_model.paddingarrayEight numeric coordinates for the padding quad.
root.box_model.borderarrayEight numeric coordinates for the border quad.
root.box_model.marginarrayEight numeric coordinates for the margin quad.
Notes
  • Dispatches through LynxDevToolMediator to InspectorTasmExecutor on the TASM thread, then asks the platform for native box models before sending the response.
  • The returned tree is built from the current element root and uses the same node fields as the standard DOM tree, with Lynx's box_model field added to each serializable node.
  • Coordinates are adjusted relative to the root box model in LynxView screenshot mode and converted by LayoutsUnitPerPx.
  • If the serialized root exceeds the native DOM compression threshold and compression succeeds, result.compress is true and result.root is a compressed base64 string.
  • If a node cannot produce a valid box model, that node's box_model field is null.
  • The native implementation does not read request params.
  • If the mediator has no TASM task runner or the element root is unavailable, the current handler does not send an explicit CDP response.
Examples

Read the DOM tree with box models

Request:

{
  "id": 1,
  "method": "DOM.getDocumentWithBoxModel"
}

Response:

{
  "id": 1,
  "result": {
    "compress": false,
    "root": {
      "nodeId": 1,
      "backendNodeId": 1,
      "nodeType": 1,
      "localName": "page",
      "nodeName": "page",
      "nodeValue": "",
      "attributes": [],
      "childNodeCount": 1,
      "box_model": {
        "width": 390,
        "height": 844,
        "content": [0, 0, 390, 0, 390, 844, 0, 844],
        "padding": [0, 0, 390, 0, 390, 844, 0, 844],
        "border": [0, 0, 390, 0, 390, 844, 0, 844],
        "margin": [0, 0, 390, 0, 390, 844, 0, 844]
      },
      "children": []
    }
  }
}

DOM.getOriginalNodeIndex

Returns the Lynx source node index associated with a DevTool node id.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_dom_agent_ng.cc
Parameters
NameTypeRequiredDescription
nodeIdintegerYesDevTool node id to resolve in the current Lynx element tree.
Returns
NameTypeDescription
nodeIndexintegerRaw node index stored on the resolved Lynx element. The field is omitted when the node id cannot be resolved.
Notes
  • Dispatches through LynxDevToolMediator to InspectorTasmExecutor on the TASM thread.
  • The handler resolves params.nodeId with the current inspector element map and returns Element::NodeIndex().
  • The response result is an empty object when no element is found for params.nodeId.
  • If the mediator has no TASM task runner, the current handler does not send an explicit CDP response.
Examples

Resolve a DevTool node to its Lynx source index

Request:

{
  "id": 1,
  "method": "DOM.getOriginalNodeIndex",
  "params": {
    "nodeId": 42
  }
}

Response:

{
  "id": 1,
  "result": {
    "nodeIndex": 7
  }
}

DOM.innerText

Returns raw text child values for a Lynx text node.

  • Origin: lynx-extension
  • Source: devtool/lynx_devtool/agent/domain_agent/inspector_dom_agent_ng.cc
Parameters
NameTypeRequiredDescription
nodeIdintegerYesDevTool node id to inspect.
Returns
NameTypeDescription
nodeIdintegerThe node id from the request.
rawTextValuesarrayRaw text child entries collected from the requested text node. Empty when the node is missing, detached, not a text element, or has no raw-text children with text attributes.
rawTextValues[].nodeIdintegerDevTool node id of the raw-text child.
rawTextValues[].textstringText attribute value from the raw-text child.
Notes
  • Dispatches through LynxDevToolMediator to InspectorTasmExecutor on the TASM thread.
  • The handler only scans attached elements whose localName is text.
  • For matching text elements, the handler walks direct raw-text children and reads their text attributes.
  • The method does not concatenate text; callers receive one rawTextValues item per raw-text child that contributes text.
  • If the mediator has no TASM task runner, the current handler does not send an explicit CDP response.
Examples

Read raw text children

Request:

{
  "id": 1,
  "method": "DOM.innerText",
  "params": {
    "nodeId": 42
  }
}

Response:

{
  "id": 1,
  "result": {
    "nodeId": 42,
    "rawTextValues": [
      {
        "nodeId": 43,
        "text": "Hello Lynx"
      }
    ]
  }
}
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.