Expand description
This domain exposes CSS read/write operations. All CSS objects
(stylesheets, rules, and styles) have an associated id used in
subsequent operations on the related object. Each object type has a
specific id structure, and those are not interchangeable between objects
of different kinds. CSS objects can be loaded using the get*ForNode()
calls (which accept a DOM node id). A client can also keep track of
stylesheets via the styleSheetAdded/styleSheetRemoved events and
subsequently load the required stylesheet contents using the
getStyleSheet\[Text\]() methods.
Method names for the CSS domain, for use with
CdpClient::call.
This domain is experimental and may change without notice.
Constants§
- ADD_
RULE - Inserts a new rule with the given
ruleTextin a stylesheet with givenstyleSheetId, at the position specified bylocation. - COLLECT_
CLASS_ NAMES - Returns all class names from specified stylesheet.
- CREATE_
STYLE_ SHEET - Creates a new special “via-inspector” stylesheet in the frame with given
frameId. - DISABLE
- Disables the CSS agent for the given page.
- ENABLE
- Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been enabled until the result of this command is received.
- FORCE_
PSEUDO_ STATE - Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
- FORCE_
STARTING_ STYLE - Ensures that the given node is in its starting-style state.
- GET_
ANIMATED_ STYLES_ FOR_ NODE - Returns the styles coming from animations & transitions including the animation & transition styles coming from inheritance chain.
- GET_
BACKGROUND_ COLORS CSS.getBackgroundColors- GET_
COMPUTED_ STYLE_ FOR_ NODE - Returns the computed style for a DOM node identified by
nodeId. - GET_
ENVIRONMENT_ VARIABLES - Returns the values of the default UA-defined environment variables used in env()
- GET_
INLINE_ STYLES_ FOR_ NODE - Returns the styles defined inline (explicitly in the “style” attribute and
implicitly, using DOM attributes) for a DOM node identified by
nodeId. - GET_
LAYERS_ FOR_ NODE - 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.
- GET_
LOCATION_ FOR_ SELECTOR - Given a CSS selector text and a style sheet ID, getLocationForSelector returns an array of locations of the CSS selector in the style sheet.
- GET_
LONGHAND_ PROPERTIES CSS.getLonghandProperties- GET_
MATCHED_ STYLES_ FOR_ NODE - Returns requested styles for a DOM node identified by
nodeId. - GET_
MEDIA_ QUERIES - Returns all media queries parsed by the rendering engine.
- GET_
PLATFORM_ FONTS_ FOR_ NODE - Requests information about platform fonts which we used to render child TextNodes in the given node.
- GET_
STYLE_ SHEET_ TEXT - Returns the current textual content for a stylesheet.
- RESOLVE_
VALUES - Resolve the specified values in the context of the provided element. For
example, a value of ‘1em’ is evaluated according to the computed
‘font-size’ of the element and a value ‘calc(1px + 2px)’ will be resolved
to ‘3px’. If the
propertyNamewas specified thevaluesare resolved as if they were property’s declaration. If a value cannot be parsed according to the provided property syntax, the value is parsed using combined syntax as if nullpropertyNamewas provided. If the value cannot be resolved even then, return the provided value without any changes. Note: this function currently does not resolve CSS random() function, it returns unmodified random() function parts.` - SET_
CONTAINER_ QUERY_ CONDITION_ TEXT CSS.setContainerQueryConditionText- SET_
CONTAINER_ QUERY_ TEXT - Modifies the expression of a container query. Deprecated. Use setContainerQueryConditionText instead.
- SET_
EFFECTIVE_ PROPERTY_ VALUE_ FOR_ NODE - Find a rule with the given active property for the given node and set the new value for this property
- SET_
KEYFRAME_ KEY - Modifies the keyframe rule key text.
- SET_
LOCAL_ FONTS_ ENABLED - Enables/disables rendering of local CSS fonts (enabled by default).
- SET_
MEDIA_ TEXT - Modifies the rule selector.
- SET_
NAVIGATION_ TEXT - Modifies the expression of a navigation at-rule.
- SET_
PROPERTY_ RULE_ PROPERTY_ NAME - Modifies the property rule property name.
- SET_
RULE_ SELECTOR - Modifies the rule selector.
- SET_
SCOPE_ TEXT - Modifies the expression of a scope at-rule.
- SET_
STYLE_ SHEET_ TEXT - Sets the new stylesheet text.
- SET_
STYLE_ TEXTS - Applies specified style edits one after another in the given order.
- SET_
SUPPORTS_ TEXT - Modifies the expression of a supports at-rule.
- START_
RULE_ USAGE_ TRACKING - Enables the selector recording.
- STOP_
RULE_ USAGE_ TRACKING - Stop tracking rule usage and return the list of rules that were used since
last call to
takeCoverageDelta(or since start of coverage instrumentation). - TAKE_
COMPUTED_ STYLE_ UPDATES - Polls the next batch of computed style updates.
- TAKE_
COVERAGE_ DELTA - Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation).
- TRACK_
COMPUTED_ STYLE_ UPDATES - Starts tracking the given computed styles for updates. The specified array of properties replaces the one previously specified. Pass empty array to disable tracking. Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified. The changes to computed style properties are only tracked for nodes pushed to the front-end by the DOM agent. If no changes to the tracked properties occur after the node has been pushed to the front-end, no updates will be issued for the node.
- TRACK_
COMPUTED_ STYLE_ UPDATES_ FOR_ NODE - Starts tracking the given node for the computed style updates and whenever
the computed style is updated for node, it queues a
computedStyleUpdatedevent with throttling. There can only be 1 node tracked for computed style updates so passing a new node id removes tracking from the previous node. Passundefinedto disable tracking.