← Back to CSS domain

CSS.getLayersForNode

Returns all layers parsed by the rendering engine for the tree scope of a node. Given a DOM element identified by nodeId, getLayersForNode returns the root layer for the nearest ancestor document or shadow root. The layer root contains the full layer tree for the tree scope and their ordering.

Domain: CSS experimental

Parameters

NameTypeDescription
nodeIdDOM.NodeId

Returns

NameTypeDescription
rootLayerCSSLayerData

Example Request

{
  "id": 1,
  "method": "CSS.getLayersForNode",
  "params": {
    "nodeId": 1
  }
}

Example Response

{
  "id": 1,
  "result": {
    "rootLayer": "rootLayer-value"
  }
}

Usage in Node.js

const result = await send('CSS.getLayersForNode', {"nodeId": 1});
console.log(result);
// {"rootLayer": "rootLayer-value"}