← Back to DOM domain
DOM.getAnchorElement
Returns the target anchor element of the given anchor query according to
https://www.w3.org/TR/css-anchor-position-1/#target.
Domain: DOM
experimental
Parameters
| Name | Type | Description |
nodeId | NodeId | Id of the positioned element from which to find the anchor. |
anchorSpecifier (optional) | string | An optional anchor specifier, as defined in
https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier.
If not provided, it will return the implicit anchor element for
the given positioned element. |
Returns
| Name | Type | Description |
nodeId | NodeId | The anchor element of the given anchor query. |
Example Request
{
"id": 1,
"method": "DOM.getAnchorElement",
"params": {
"nodeId": 1
}
}
Example Response
{
"id": 1,
"result": {
"nodeId": 3
}
}
Usage in Node.js
const result = await send('DOM.getAnchorElement', {"nodeId": 1});
console.log(result);
// {"nodeId": 3}