protocol/dom

⚙️ This module was generated from the Chrome DevTools Protocol version 1.3

DOM Domain

This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an id. This id can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client’s responsibility to collect information about the nodes that were sent to the client. Note that iframe owner elements will return corresponding document elements as their child nodes.

📖 View this domain on the DevTools Protocol API Docs

Types

Backend node with a friendly name.

pub type BackendNode {
  BackendNode(
    node_type: Int,
    node_name: String,
    backend_node_id: BackendNodeId,
  )
}

Constructors

  • BackendNode(
      node_type: Int,
      node_name: String,
      backend_node_id: BackendNodeId,
    )

    Arguments

    • node_type

      Node’s nodeType.

    • node_name

      Node’s nodeName.

Unique DOM node identifier used to reference a node that may not have been pushed to the front-end.

pub type BackendNodeId {
  BackendNodeId(Int)
}

Constructors

  • BackendNodeId(Int)

Box model.

pub type BoxModel {
  BoxModel(
    content: Quad,
    padding: Quad,
    border: Quad,
    margin: Quad,
    width: Int,
    height: Int,
    shape_outside: option.Option(ShapeOutsideInfo),
  )
}

Constructors

  • BoxModel(
      content: Quad,
      padding: Quad,
      border: Quad,
      margin: Quad,
      width: Int,
      height: Int,
      shape_outside: option.Option(ShapeOutsideInfo),
    )

    Arguments

    • content

      Content box

    • padding

      Padding box

    • border

      Border box

    • margin

      Margin box

    • width

      Node width

    • height

      Node height

    • shape_outside

      Shape outside coordinates

pub type CSSComputedStyleProperty {
  CSSComputedStyleProperty(name: String, value: String)
}

Constructors

  • CSSComputedStyleProperty(name: String, value: String)

    Arguments

    • name

      Computed style property name.

    • value

      Computed style property value.

Document compatibility mode.

pub type CompatibilityMode {
  CompatibilityModeQuirksMode
  CompatibilityModeLimitedQuirksMode
  CompatibilityModeNoQuirksMode
}

Constructors

  • CompatibilityModeQuirksMode
  • CompatibilityModeLimitedQuirksMode
  • CompatibilityModeNoQuirksMode

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command describe_node

pub type DescribeNodeResponse {
  DescribeNodeResponse(node: Node)
}

Constructors

  • DescribeNodeResponse(node: Node)

    Arguments

    • node

      Node description.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_attributes

pub type GetAttributesResponse {
  GetAttributesResponse(attributes: List(String))
}

Constructors

  • GetAttributesResponse(attributes: List(String))

    Arguments

    • attributes

      An interleaved array of node attribute names and values.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_box_model

pub type GetBoxModelResponse {
  GetBoxModelResponse(model: BoxModel)
}

Constructors

  • GetBoxModelResponse(model: BoxModel)

    Arguments

    • model

      Box model for the node.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_document

pub type GetDocumentResponse {
  GetDocumentResponse(root: Node)
}

Constructors

  • GetDocumentResponse(root: Node)

    Arguments

    • root

      Resulting node.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_node_for_location

pub type GetNodeForLocationResponse {
  GetNodeForLocationResponse(
    backend_node_id: BackendNodeId,
    frame_id: String,
    node_id: option.Option(NodeId),
  )
}

Constructors

  • GetNodeForLocationResponse(
      backend_node_id: BackendNodeId,
      frame_id: String,
      node_id: option.Option(NodeId),
    )

    Arguments

    • backend_node_id

      Resulting node.

    • frame_id

      Frame this node belongs to.

    • node_id

      Id of the node at given coordinates, only when enabled and requested document.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_outer_html

pub type GetOuterHtmlResponse {
  GetOuterHtmlResponse(outer_html: String)
}

Constructors

  • GetOuterHtmlResponse(outer_html: String)

    Arguments

    • outer_html

      Outer HTML markup.

ContainerSelector logical axes

pub type LogicalAxes {
  LogicalAxesInline
  LogicalAxesBlock
  LogicalAxesBoth
}

Constructors

  • LogicalAxesInline
  • LogicalAxesBlock
  • LogicalAxesBoth

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command move_to

pub type MoveToResponse {
  MoveToResponse(node_id: NodeId)
}

Constructors

  • MoveToResponse(node_id: NodeId)

    Arguments

    • node_id

      New id of the moved node.

DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type.

pub type Node {
  Node(
    node_id: NodeId,
    parent_id: option.Option(NodeId),
    backend_node_id: BackendNodeId,
    node_type: Int,
    node_name: String,
    local_name: String,
    node_value: String,
    child_node_count: option.Option(Int),
    children: option.Option(List(Node)),
    attributes: option.Option(List(String)),
    document_url: option.Option(String),
    base_url: option.Option(String),
    public_id: option.Option(String),
    system_id: option.Option(String),
    internal_subset: option.Option(String),
    xml_version: option.Option(String),
    name: option.Option(String),
    value: option.Option(String),
    pseudo_type: option.Option(PseudoType),
    pseudo_identifier: option.Option(String),
    shadow_root_type: option.Option(ShadowRootType),
    frame_id: option.Option(String),
    content_document: option.Option(Node),
    shadow_roots: option.Option(List(Node)),
    template_content: option.Option(Node),
    pseudo_elements: option.Option(List(Node)),
    distributed_nodes: option.Option(List(BackendNode)),
    is_svg: option.Option(Bool),
    compatibility_mode: option.Option(CompatibilityMode),
    assigned_slot: option.Option(BackendNode),
  )
}

Constructors

  • Node(
      node_id: NodeId,
      parent_id: option.Option(NodeId),
      backend_node_id: BackendNodeId,
      node_type: Int,
      node_name: String,
      local_name: String,
      node_value: String,
      child_node_count: option.Option(Int),
      children: option.Option(List(Node)),
      attributes: option.Option(List(String)),
      document_url: option.Option(String),
      base_url: option.Option(String),
      public_id: option.Option(String),
      system_id: option.Option(String),
      internal_subset: option.Option(String),
      xml_version: option.Option(String),
      name: option.Option(String),
      value: option.Option(String),
      pseudo_type: option.Option(PseudoType),
      pseudo_identifier: option.Option(String),
      shadow_root_type: option.Option(ShadowRootType),
      frame_id: option.Option(String),
      content_document: option.Option(Node),
      shadow_roots: option.Option(List(Node)),
      template_content: option.Option(Node),
      pseudo_elements: option.Option(List(Node)),
      distributed_nodes: option.Option(List(BackendNode)),
      is_svg: option.Option(Bool),
      compatibility_mode: option.Option(CompatibilityMode),
      assigned_slot: option.Option(BackendNode),
    )

    Arguments

    • node_id

      Node identifier that is passed into the rest of the DOM messages as the nodeId. Backend will only push node with given id once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client.

    • parent_id

      The id of the parent node if any.

    • backend_node_id

      The BackendNodeId for this node.

    • node_type

      Node’s nodeType.

    • node_name

      Node’s nodeName.

    • local_name

      Node’s localName.

    • node_value

      Node’s nodeValue.

    • child_node_count

      Child count for Container nodes.

    • children

      Child nodes of this node when requested with children.

    • attributes

      Attributes of the Element node in the form of flat array [name1, value1, name2, value2].

    • document_url

      Document URL that Document or FrameOwner node points to.

    • base_url

      Base URL that Document or FrameOwner node uses for URL completion.

    • public_id

      DocumentType’s publicId.

    • system_id

      DocumentType’s systemId.

    • internal_subset

      DocumentType’s internalSubset.

    • xml_version

      Document’s XML version in case of XML documents.

    • name

      Attr’s name.

    • value

      Attr’s value.

    • pseudo_type

      Pseudo element type for this node.

    • pseudo_identifier

      Pseudo element identifier for this node. Only present if there is a valid pseudoType.

    • shadow_root_type

      Shadow root type.

    • frame_id

      Frame ID for frame owner elements.

    • content_document

      Content document for frame owner elements.

    • shadow_roots

      Shadow root list for given element host.

    • template_content

      Content document fragment for template elements.

    • pseudo_elements

      Pseudo elements associated with this node.

    • distributed_nodes

      Distributed nodes for given insertion point.

    • is_svg

      Whether the node is SVG.

Unique DOM node identifier.

pub type NodeId {
  NodeId(Int)
}

Constructors

  • NodeId(Int)

ContainerSelector physical axes

pub type PhysicalAxes {
  PhysicalAxesHorizontal
  PhysicalAxesVertical
  PhysicalAxesBoth
}

Constructors

  • PhysicalAxesHorizontal
  • PhysicalAxesVertical
  • PhysicalAxesBoth

Pseudo element type.

pub type PseudoType {
  PseudoTypeFirstLine
  PseudoTypeFirstLetter
  PseudoTypeBefore
  PseudoTypeAfter
  PseudoTypeMarker
  PseudoTypeBackdrop
  PseudoTypeSelection
  PseudoTypeTargetText
  PseudoTypeSpellingError
  PseudoTypeGrammarError
  PseudoTypeHighlight
  PseudoTypeFirstLineInherited
  PseudoTypeScrollMarker
  PseudoTypeScrollMarkers
  PseudoTypeScrollbar
  PseudoTypeScrollbarThumb
  PseudoTypeScrollbarButton
  PseudoTypeScrollbarTrack
  PseudoTypeScrollbarTrackPiece
  PseudoTypeScrollbarCorner
  PseudoTypeResizer
  PseudoTypeInputListButton
  PseudoTypeViewTransition
  PseudoTypeViewTransitionGroup
  PseudoTypeViewTransitionImagePair
  PseudoTypeViewTransitionOld
  PseudoTypeViewTransitionNew
}

Constructors

  • PseudoTypeFirstLine
  • PseudoTypeFirstLetter
  • PseudoTypeBefore
  • PseudoTypeAfter
  • PseudoTypeMarker
  • PseudoTypeBackdrop
  • PseudoTypeSelection
  • PseudoTypeTargetText
  • PseudoTypeSpellingError
  • PseudoTypeGrammarError
  • PseudoTypeHighlight
  • PseudoTypeFirstLineInherited
  • PseudoTypeScrollMarker
  • PseudoTypeScrollMarkers
  • PseudoTypeScrollbar
  • PseudoTypeScrollbarThumb
  • PseudoTypeScrollbarButton
  • PseudoTypeScrollbarTrack
  • PseudoTypeScrollbarTrackPiece
  • PseudoTypeScrollbarCorner
  • PseudoTypeResizer
  • PseudoTypeInputListButton
  • PseudoTypeViewTransition
  • PseudoTypeViewTransitionGroup
  • PseudoTypeViewTransitionImagePair
  • PseudoTypeViewTransitionOld
  • PseudoTypeViewTransitionNew

An array of quad vertices, x immediately followed by y for each point, points clock-wise.

pub type Quad {
  Quad(List(Float))
}

Constructors

  • Quad(List(Float))

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command query_selector_all

pub type QuerySelectorAllResponse {
  QuerySelectorAllResponse(node_ids: List(NodeId))
}

Constructors

  • QuerySelectorAllResponse(node_ids: List(NodeId))

    Arguments

    • node_ids

      Query selector result.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command query_selector

pub type QuerySelectorResponse {
  QuerySelectorResponse(node_id: NodeId)
}

Constructors

  • QuerySelectorResponse(node_id: NodeId)

    Arguments

    • node_id

      Query selector result.

A structure holding an RGBA color.

pub type RGBA {
  RGBA(r: Int, g: Int, b: Int, a: option.Option(Float))
}

Constructors

  • RGBA(r: Int, g: Int, b: Int, a: option.Option(Float))

    Arguments

    • r

      The red component, in the [0-255] range.

    • g

      The green component, in the [0-255] range.

    • b

      The blue component, in the [0-255] range.

    • a

      The alpha component, in the [0-1] range (default: 1).

Rectangle.

pub type Rect {
  Rect(x: Float, y: Float, width: Float, height: Float)
}

Constructors

  • Rect(x: Float, y: Float, width: Float, height: Float)

    Arguments

    • x

      X coordinate

    • y

      Y coordinate

    • width

      Rectangle width

    • height

      Rectangle height

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command request_node

pub type RequestNodeResponse {
  RequestNodeResponse(node_id: NodeId)
}

Constructors

  • RequestNodeResponse(node_id: NodeId)

    Arguments

    • node_id

      Node id for given object.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command resolve_node

pub type ResolveNodeResponse {
  ResolveNodeResponse(object: runtime.RemoteObject)
}

Constructors

  • ResolveNodeResponse(object: runtime.RemoteObject)

    Arguments

    • object

      JavaScript object wrapper for given node.

Physical scroll orientation

pub type ScrollOrientation {
  ScrollOrientationHorizontal
  ScrollOrientationVertical
}

Constructors

  • ScrollOrientationHorizontal
  • ScrollOrientationVertical

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command set_node_name

pub type SetNodeNameResponse {
  SetNodeNameResponse(node_id: NodeId)
}

Constructors

  • SetNodeNameResponse(node_id: NodeId)

    Arguments

    • node_id

      New node’s id.

Shadow root type.

pub type ShadowRootType {
  ShadowRootTypeUserAgent
  ShadowRootTypeOpen
  ShadowRootTypeClosed
}

Constructors

  • ShadowRootTypeUserAgent
  • ShadowRootTypeOpen
  • ShadowRootTypeClosed

CSS Shape Outside details.

pub type ShapeOutsideInfo {
  ShapeOutsideInfo(
    bounds: Quad,
    shape: List(dynamic.Dynamic),
    margin_shape: List(dynamic.Dynamic),
  )
}

Constructors

  • ShapeOutsideInfo(
      bounds: Quad,
      shape: List(dynamic.Dynamic),
      margin_shape: List(dynamic.Dynamic),
    )

    Arguments

    • bounds

      Shape bounds

    • shape

      Shape coordinate details

    • margin_shape

      Margin shape bounds

Functions

pub fn describe_node(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  node_id node_id: Option(NodeId),
  backend_node_id backend_node_id: Option(BackendNodeId),
  object_id object_id: Option(RemoteObjectId),
  depth depth: Option(Int),
  pierce pierce: Option(Bool),
) -> Result(DescribeNodeResponse, RequestError)

Describes node given its id, does not require domain to be enabled. Does not start tracking any objects, can be used for automation.

Parameters:

  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.
  • depth : The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
  • pierce : Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).

Returns:

  • node : Node description.
pub fn disable(callback__: fn(String, Option(a)) -> b) -> b

Disables DOM agent for the given page.

pub fn enable(callback__: fn(String, Option(a)) -> b) -> b

Enables DOM agent for the given page.

Parameters:

Returns:

pub fn focus(
  callback__: fn(String, Option(Json)) -> a,
  node_id node_id: Option(NodeId),
  backend_node_id backend_node_id: Option(BackendNodeId),
  object_id object_id: Option(RemoteObjectId),
) -> a

Focuses the given element.

Parameters:

  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.

Returns:

pub fn get_attributes(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  node_id node_id: NodeId,
) -> Result(GetAttributesResponse, RequestError)

Returns attributes for the specified node.

Parameters:

  • node_id : Id of the node to retrieve attributes for.

Returns:

  • attributes : An interleaved array of node attribute names and values.
pub fn get_box_model(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  node_id node_id: Option(NodeId),
  backend_node_id backend_node_id: Option(BackendNodeId),
  object_id object_id: Option(RemoteObjectId),
) -> Result(GetBoxModelResponse, RequestError)

Returns boxes for the given node.

Parameters:

  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.

Returns:

  • model : Box model for the node.
pub fn get_document(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  depth depth: Option(Int),
  pierce pierce: Option(Bool),
) -> Result(GetDocumentResponse, RequestError)

Returns the root DOM node (and optionally the subtree) to the caller. Implicitly enables the DOM domain events for the current target.

Parameters:

  • depth : The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
  • pierce : Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).

Returns:

  • root : Resulting node.
pub fn get_node_for_location(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  x x: Int,
  y y: Int,
  include_user_agent_shadow_dom include_user_agent_shadow_dom: Option(
    Bool,
  ),
  ignore_pointer_events_none ignore_pointer_events_none: Option(
    Bool,
  ),
) -> Result(GetNodeForLocationResponse, RequestError)

Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is either returned or not.

Parameters:

  • x : X coordinate.
  • y : Y coordinate.
  • include_user_agent_shadow_dom : False to skip to the nearest non-UA shadow root ancestor (default: false).
  • ignore_pointer_events_none : Whether to ignore pointer-events: none on elements and hit test them.

Returns:

  • backend_node_id : Resulting node.
  • frame_id : Frame this node belongs to.
  • node_id : Id of the node at given coordinates, only when enabled and requested document.
pub fn get_outer_html(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  node_id node_id: Option(NodeId),
  backend_node_id backend_node_id: Option(BackendNodeId),
  object_id object_id: Option(RemoteObjectId),
) -> Result(GetOuterHtmlResponse, RequestError)

Returns node’s HTML markup.

Parameters:

  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.

Returns:

  • outer_html : Outer HTML markup.
pub fn hide_highlight(
  callback__: fn(String, Option(a)) -> b,
) -> b

Hides any highlight.

pub fn highlight_node(
  callback__: fn(String, Option(a)) -> b,
) -> b

Highlights DOM node.

pub fn highlight_rect(
  callback__: fn(String, Option(a)) -> b,
) -> b

Highlights given rectangle.

pub fn move_to(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  node_id node_id: NodeId,
  target_node_id target_node_id: NodeId,
  insert_before_node_id insert_before_node_id: Option(NodeId),
) -> Result(MoveToResponse, RequestError)

Moves node into the new container, places it before the given anchor.

Parameters:

  • node_id : Id of the node to move.
  • target_node_id : Id of the element to drop the moved node into.
  • insert_before_node_id : Drop node before this one (if absent, the moved node becomes the last child of targetNodeId).

Returns:

  • node_id : New id of the moved node.
pub fn query_selector(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  node_id node_id: NodeId,
  selector selector: String,
) -> Result(QuerySelectorResponse, RequestError)

Executes querySelector on a given node.

Parameters:

  • node_id : Id of the node to query upon.
  • selector : Selector string.

Returns:

  • node_id : Query selector result.
pub fn query_selector_all(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  node_id node_id: NodeId,
  selector selector: String,
) -> Result(QuerySelectorAllResponse, RequestError)

Executes querySelectorAll on a given node.

Parameters:

  • node_id : Id of the node to query upon.
  • selector : Selector string.

Returns:

  • node_ids : Query selector result.
pub fn remove_attribute(
  callback__: fn(String, Option(Json)) -> a,
  node_id node_id: NodeId,
  name name: String,
) -> a

Removes attribute with given name from an element with given id.

Parameters:

  • node_id : Id of the element to remove attribute from.
  • name : Name of the attribute to remove.

Returns:

pub fn remove_node(
  callback__: fn(String, Option(Json)) -> a,
  node_id node_id: NodeId,
) -> a

Removes node with given id.

Parameters:

  • node_id : Id of the node to remove.

Returns:

pub fn request_child_nodes(
  callback__: fn(String, Option(Json)) -> a,
  node_id node_id: NodeId,
  depth depth: Option(Int),
  pierce pierce: Option(Bool),
) -> a

Requests that children of the node with given id are returned to the caller in form of setChildNodes events where not only immediate children are retrieved, but all children down to the specified depth.

Parameters:

  • node_id : Id of the node to get children for.
  • depth : The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
  • pierce : Whether or not iframes and shadow roots should be traversed when returning the sub-tree (default is false).

Returns:

pub fn request_node(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  object_id object_id: RemoteObjectId,
) -> Result(RequestNodeResponse, RequestError)

Requests that the node is sent to the caller given the JavaScript node object reference. All nodes that form the path from the node to the root are also sent to the client as a series of setChildNodes notifications.

Parameters:

  • object_id : JavaScript object id to convert into node.

Returns:

  • node_id : Node id for given object.
pub fn resolve_node(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  node_id node_id: Option(NodeId),
  backend_node_id backend_node_id: Option(BackendNodeId),
  object_group object_group: Option(String),
  execution_context_id execution_context_id: Option(
    ExecutionContextId,
  ),
) -> Result(ResolveNodeResponse, RequestError)

Resolves the JavaScript node object for a given NodeId or BackendNodeId.

Parameters:

  • node_id : Id of the node to resolve.
  • backend_node_id : Backend identifier of the node to resolve.
  • object_group : Symbolic group name that can be used to release multiple objects.
  • execution_context_id : Execution context in which to resolve the node.

Returns:

  • object : JavaScript object wrapper for given node.
pub fn scroll_into_view_if_needed(
  callback__: fn(String, Option(Json)) -> a,
  node_id node_id: Option(NodeId),
  backend_node_id backend_node_id: Option(BackendNodeId),
  object_id object_id: Option(RemoteObjectId),
  rect rect: Option(Rect),
) -> a

Scrolls the specified rect of the given node into view if not already visible. Note: exactly one between nodeId, backendNodeId and objectId should be passed to identify the node.

Parameters:

  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.
  • rect : The rect to be scrolled into view, relative to the node’s border box, in CSS pixels. When omitted, center of the node will be used, similar to Element.scrollIntoView.

Returns:

pub fn set_attribute_value(
  callback__: fn(String, Option(Json)) -> a,
  node_id node_id: NodeId,
  name name: String,
  value value: String,
) -> a

Sets attribute for an element with given id.

Parameters:

  • node_id : Id of the element to set attribute for.
  • name : Attribute name.
  • value : Attribute value.

Returns:

pub fn set_attributes_as_text(
  callback__: fn(String, Option(Json)) -> a,
  node_id node_id: NodeId,
  text text: String,
  name name: Option(String),
) -> a

Sets attributes on element with given id. This method is useful when user edits some existing attribute value and types in several attribute name/value pairs.

Parameters:

  • node_id : Id of the element to set attributes for.
  • text : Text with a number of attributes. Will parse this text using HTML parser.
  • name : Attribute name to replace with new attributes derived from text in case text parsed successfully.

Returns:

pub fn set_file_input_files(
  callback__: fn(String, Option(Json)) -> a,
  files files: List(String),
  node_id node_id: Option(NodeId),
  backend_node_id backend_node_id: Option(BackendNodeId),
  object_id object_id: Option(RemoteObjectId),
) -> a

Sets files for the given file input element.

Parameters:

  • files : Array of file paths to set.
  • node_id : Identifier of the node.
  • backend_node_id : Identifier of the backend node.
  • object_id : JavaScript object id of the node wrapper.

Returns:

pub fn set_node_name(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  node_id node_id: NodeId,
  name name: String,
) -> Result(SetNodeNameResponse, RequestError)

Sets node name for a node with given id.

Parameters:

  • node_id : Id of the node to set name for.
  • name : New node’s name.

Returns:

  • node_id : New node’s id.
pub fn set_node_value(
  callback__: fn(String, Option(Json)) -> a,
  node_id node_id: NodeId,
  value value: String,
) -> a

Sets node value for a node with given id.

Parameters:

  • node_id : Id of the node to set value for.
  • value : New node’s value.

Returns:

pub fn set_outer_html(
  callback__: fn(String, Option(Json)) -> a,
  node_id node_id: NodeId,
  outer_html outer_html: String,
) -> a

Sets node HTML markup, returns new node id.

Parameters:

  • node_id : Id of the node to set markup for.
  • outer_html : Outer HTML markup to set.

Returns:

Search Document