Skip to main content

Module css

Module css 

Source
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 ruleText in a stylesheet with given styleSheetId, at the position specified by location.
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 propertyName was specified the values are 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 null propertyName was 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 computedStyleUpdated event 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. Pass undefined to disable tracking.