← Back to CSS domain

CSS.getLocationForSelector

Given a CSS selector text and a style sheet ID, getLocationForSelector returns an array of locations of the CSS selector in the style sheet.

Domain: CSS experimental

Parameters

NameTypeDescription
styleSheetIdDOM.StyleSheetId
selectorTextstring

Returns

NameTypeDescription
rangesarray

Example Request

{
  "id": 1,
  "method": "CSS.getLocationForSelector",
  "params": {
    "styleSheetId": "styleSheetId-value",
    "selectorText": "selectorText-value"
  }
}

Example Response

{
  "id": 1,
  "result": {
    "ranges": []
  }
}

Usage in Node.js

const result = await send('CSS.getLocationForSelector', {"styleSheetId": "styleSheetId-value", "selectorText": "selectorText-value"});
console.log(result);
// {"ranges": []}