getContainerForNode method

Future<NodeId> getContainerForNode(
  1. NodeId nodeId, {
  2. String? containerName,
  3. PhysicalAxes? physicalAxes,
  4. LogicalAxes? logicalAxes,
  5. bool? queriesScrollState,
})

Returns the query container of the given node based on container query conditions: containerName, physical and logical axes, and whether it queries scroll-state. If no axes are provided and queriesScrollState is false, the style container is returned, which is the direct parent or the closest element with a matching container-name. Returns: The container node for the given node, or null if not found.

Implementation

Future<NodeId> getContainerForNode(
  NodeId nodeId, {
  String? containerName,
  PhysicalAxes? physicalAxes,
  LogicalAxes? logicalAxes,
  bool? queriesScrollState,
}) async {
  var result = await _client.send('DOM.getContainerForNode', {
    'nodeId': nodeId,
    if (containerName != null) 'containerName': containerName,
    if (physicalAxes != null) 'physicalAxes': physicalAxes,
    if (logicalAxes != null) 'logicalAxes': logicalAxes,
    if (queriesScrollState != null) 'queriesScrollState': queriesScrollState,
  });
  return NodeId.fromJson(result['nodeId'] as int);
}