← Back to DOM domain
DOM.getNodesForSubtreeByStyle
Finds nodes with a given computed style in a subtree.
Domain: DOM
experimental
Parameters
| Name | Type | Description |
nodeId | NodeId | Node ID pointing to the root of a subtree. |
computedStyles | array | The style to filter nodes by (includes nodes if any of properties matches). |
pierce (optional) | boolean | Whether or not iframes and shadow roots in the same target should be traversed when returning the
results (default is false). |
Returns
| Name | Type | Description |
nodeIds | array | Resulting nodes. |
Example Request
{
"id": 1,
"method": "DOM.getNodesForSubtreeByStyle",
"params": {
"nodeId": 1,
"computedStyles": []
}
}
Example Response
{
"id": 1,
"result": {
"nodeIds": [
3,
4,
5
]
}
}
Usage in Node.js
const result = await send('DOM.getNodesForSubtreeByStyle', {"nodeId": 1, "computedStyles": []});
console.log(result);
// {"nodeIds": [3, 4, 5]}