clj-chrome-devtools.commands.css

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.

add-rule

(add-rule)(add-rule {:as params, :keys [style-sheet-id rule-text location]})(add-rule connection {:as params, :keys [style-sheet-id rule-text location]})

Inserts a new rule with the given ruleText in a stylesheet with given styleSheetId, at the position specified by location.

Parameters map keys:

Key Description
:style-sheet-id The css style sheet identifier where a new rule should be inserted.
:rule-text The text of a new rule.
:location Text position of a new rule in the target style sheet.

Return map keys:

Key Description
:rule The newly created rule.

collect-class-names

(collect-class-names)(collect-class-names {:as params, :keys [style-sheet-id]})(collect-class-names connection {:as params, :keys [style-sheet-id]})

Returns all class names from specified stylesheet.

Parameters map keys:

Key Description
:style-sheet-id null

Return map keys:

Key Description
:class-names Class name list.

create-style-sheet

(create-style-sheet)(create-style-sheet {:as params, :keys [frame-id]})(create-style-sheet connection {:as params, :keys [frame-id]})

Creates a new special “via-inspector” stylesheet in the frame with given frameId.

Parameters map keys:

Key Description
:frame-id Identifier of the frame where “via-inspector” stylesheet should be created.

Return map keys:

Key Description
:style-sheet-id Identifier of the created “via-inspector” stylesheet.

disable

(disable)(disable {:as params, :keys []})(disable connection {:as params, :keys []})

Disables the CSS agent for the given page.

enable

(enable)(enable {:as params, :keys []})(enable connection {:as params, :keys []})

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

(force-pseudo-state)(force-pseudo-state {:as params, :keys [node-id forced-pseudo-classes]})(force-pseudo-state connection {:as params, :keys [node-id forced-pseudo-classes]})

Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.

Parameters map keys:

Key Description
:node-id The element id for which to force the pseudo state.
:forced-pseudo-classes Element pseudo classes to force when computing the element’s style.

get-background-colors

(get-background-colors)(get-background-colors {:as params, :keys [node-id]})(get-background-colors connection {:as params, :keys [node-id]})

Parameters map keys:

Key Description
:node-id Id of the node to get background colors for.

Return map keys:

Key Description
:background-colors The range of background colors behind this element, if it contains any visible text. If no

visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load). (optional) :computed-font-size | The computed font size for this node, as a CSS computed value string (e.g. ‘12px’). (optional) :computed-font-weight | The computed font weight for this node, as a CSS computed value string (e.g. ‘normal’ or ‘100’). (optional)

get-computed-style-for-node

(get-computed-style-for-node)(get-computed-style-for-node {:as params, :keys [node-id]})(get-computed-style-for-node connection {:as params, :keys [node-id]})

Returns the computed style for a DOM node identified by nodeId.

Parameters map keys:

Key Description
:node-id null

Return map keys:

Key Description
:computed-style Computed style for the specified DOM node.

get-inline-styles-for-node

(get-inline-styles-for-node)(get-inline-styles-for-node {:as params, :keys [node-id]})(get-inline-styles-for-node connection {:as params, :keys [node-id]})

Returns the styles defined inline (explicitly in the “style” attribute and implicitly, using DOM attributes) for a DOM node identified by nodeId.

Parameters map keys:

Key Description
:node-id null

Return map keys:

Key Description
:inline-style Inline style for the specified DOM node. (optional)
:attributes-style Attribute-defined element style (e.g. resulting from “width=20 height=100%”). (optional)

get-layers-for-node

(get-layers-for-node)(get-layers-for-node {:as params, :keys [node-id]})(get-layers-for-node connection {:as params, :keys [node-id]})

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.

Parameters map keys:

Key Description
:node-id null

Return map keys:

Key Description
:root-layer null

get-matched-styles-for-node

(get-matched-styles-for-node)(get-matched-styles-for-node {:as params, :keys [node-id]})(get-matched-styles-for-node connection {:as params, :keys [node-id]})

Returns requested styles for a DOM node identified by nodeId.

Parameters map keys:

Key Description
:node-id null

Return map keys:

Key Description
:inline-style Inline style for the specified DOM node. (optional)
:attributes-style Attribute-defined element style (e.g. resulting from “width=20 height=100%”). (optional)
:matched-css-rules CSS rules matching this node, from all applicable stylesheets. (optional)
:pseudo-elements Pseudo style matches for this node. (optional)
:inherited A chain of inherited styles (from the immediate node parent up to the DOM tree root). (optional)
:inherited-pseudo-elements A chain of inherited pseudo element styles (from the immediate node parent up to the DOM tree root). (optional)
:css-keyframes-rules A list of CSS keyframed animations matching this node. (optional)

get-media-queries

(get-media-queries)(get-media-queries {:as params, :keys []})(get-media-queries connection {:as params, :keys []})

Returns all media queries parsed by the rendering engine.

Return map keys:

Key Description
:medias null

get-platform-fonts-for-node

(get-platform-fonts-for-node)(get-platform-fonts-for-node {:as params, :keys [node-id]})(get-platform-fonts-for-node connection {:as params, :keys [node-id]})

Requests information about platform fonts which we used to render child TextNodes in the given node.

Parameters map keys:

Key Description
:node-id null

Return map keys:

Key Description
:fonts Usage statistics for every employed platform font.

get-style-sheet-text

(get-style-sheet-text)(get-style-sheet-text {:as params, :keys [style-sheet-id]})(get-style-sheet-text connection {:as params, :keys [style-sheet-id]})

Returns the current textual content for a stylesheet.

Parameters map keys:

Key Description
:style-sheet-id null

Return map keys:

Key Description
:text The stylesheet text.

set-container-query-text

(set-container-query-text)(set-container-query-text {:as params, :keys [style-sheet-id range text]})(set-container-query-text connection {:as params, :keys [style-sheet-id range text]})

Modifies the expression of a container query.

Parameters map keys:

Key Description
:style-sheet-id null
:range null
:text null

Return map keys:

Key Description
:container-query The resulting CSS container query rule after modification.

set-effective-property-value-for-node

(set-effective-property-value-for-node)(set-effective-property-value-for-node {:as params, :keys [node-id property-name value]})(set-effective-property-value-for-node connection {:as params, :keys [node-id property-name value]})

Find a rule with the given active property for the given node and set the new value for this property

Parameters map keys:

Key Description
:node-id The element id for which to set property.
:property-name null
:value null

set-keyframe-key

(set-keyframe-key)(set-keyframe-key {:as params, :keys [style-sheet-id range key-text]})(set-keyframe-key connection {:as params, :keys [style-sheet-id range key-text]})

Modifies the keyframe rule key text.

Parameters map keys:

Key Description
:style-sheet-id null
:range null
:key-text null

Return map keys:

Key Description
:key-text The resulting key text after modification.

set-local-fonts-enabled

(set-local-fonts-enabled)(set-local-fonts-enabled {:as params, :keys [enabled]})(set-local-fonts-enabled connection {:as params, :keys [enabled]})

Enables/disables rendering of local CSS fonts (enabled by default).

Parameters map keys:

Key Description
:enabled Whether rendering of local fonts is enabled.

set-media-text

(set-media-text)(set-media-text {:as params, :keys [style-sheet-id range text]})(set-media-text connection {:as params, :keys [style-sheet-id range text]})

Modifies the rule selector.

Parameters map keys:

Key Description
:style-sheet-id null
:range null
:text null

Return map keys:

Key Description
:media The resulting CSS media rule after modification.

set-rule-selector

(set-rule-selector)(set-rule-selector {:as params, :keys [style-sheet-id range selector]})(set-rule-selector connection {:as params, :keys [style-sheet-id range selector]})

Modifies the rule selector.

Parameters map keys:

Key Description
:style-sheet-id null
:range null
:selector null

Return map keys:

Key Description
:selector-list The resulting selector list after modification.

set-style-sheet-text

(set-style-sheet-text)(set-style-sheet-text {:as params, :keys [style-sheet-id text]})(set-style-sheet-text connection {:as params, :keys [style-sheet-id text]})

Sets the new stylesheet text.

Parameters map keys:

Key Description
:style-sheet-id null
:text null

Return map keys:

Key Description
:source-map-url URL of source map associated with script (if any). (optional)

set-style-texts

(set-style-texts)(set-style-texts {:as params, :keys [edits]})(set-style-texts connection {:as params, :keys [edits]})

Applies specified style edits one after another in the given order.

Parameters map keys:

Key Description
:edits null

Return map keys:

Key Description
:styles The resulting styles after modification.

set-supports-text

(set-supports-text)(set-supports-text {:as params, :keys [style-sheet-id range text]})(set-supports-text connection {:as params, :keys [style-sheet-id range text]})

Modifies the expression of a supports at-rule.

Parameters map keys:

Key Description
:style-sheet-id null
:range null
:text null

Return map keys:

Key Description
:supports The resulting CSS Supports rule after modification.

start-rule-usage-tracking

(start-rule-usage-tracking)(start-rule-usage-tracking {:as params, :keys []})(start-rule-usage-tracking connection {:as params, :keys []})

Enables the selector recording.

stop-rule-usage-tracking

(stop-rule-usage-tracking)(stop-rule-usage-tracking {:as params, :keys []})(stop-rule-usage-tracking connection {:as params, :keys []})

Stop tracking rule usage and return the list of rules that were used since last call to takeCoverageDelta (or since start of coverage instrumentation)

Return map keys:

Key Description
:rule-usage null

take-computed-style-updates

(take-computed-style-updates)(take-computed-style-updates {:as params, :keys []})(take-computed-style-updates connection {:as params, :keys []})

Polls the next batch of computed style updates.

Return map keys:

Key Description
:node-ids The list of node Ids that have their tracked computed styles updated

take-coverage-delta

(take-coverage-delta)(take-coverage-delta {:as params, :keys []})(take-coverage-delta connection {:as params, :keys []})

Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)

Return map keys:

Key Description
:coverage null
:timestamp Monotonically increasing time, in seconds.

track-computed-style-updates

(track-computed-style-updates)(track-computed-style-updates {:as params, :keys [properties-to-track]})(track-computed-style-updates connection {:as params, :keys [properties-to-track]})

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.

Parameters map keys:

Key Description
:properties-to-track null