Interface Selection

All Known Implementing Classes:
SelectionImpl

public interface Selection
A Selection object presents the range of text selected by the user or the current position of the caret. To obtain a Selection object for examination or modification, call Window.getSelection().
  • Method Details

    • getAnchorNode

      Node getAnchorNode()

      getAnchorNode.

      Returns:
      a Node object.
    • getAnchorOffset

      int getAnchorOffset()

      getAnchorOffset.

      Returns:
      a Integer object.
    • getFocusNode

      Node getFocusNode()

      getFocusNode.

      Returns:
      a Node object.
    • getFocusOffset

      int getFocusOffset()

      getFocusOffset.

      Returns:
      a Integer object.
    • isIsCollapsed

      boolean isIsCollapsed()

      isIsCollapsed.

      Returns:
      a boolean.
    • getRangeCount

      int getRangeCount()

      getRangeCount.

      Returns:
      a Integer object.
    • getType

      String getType()

      getType.

      Returns:
      a String object.
    • addRange

      void addRange(Range range)

      addRange.

      Parameters:
      range - a Range object.
    • collapse

      void collapse(Node node, int offset)

      collapse.

      Parameters:
      node - a Node object.
      offset - a Integer object.
    • collapse

      void collapse(Node node)

      collapse.

      Parameters:
      node - a Node object.
    • collapseToEnd

      void collapseToEnd()

      collapseToEnd.

    • collapseToStart

      void collapseToStart()

      collapseToStart.

    • containsNode

      boolean containsNode(Node node, boolean allowPartialContainment)

      containsNode.

      Parameters:
      node - a Node object.
      allowPartialContainment - a boolean.
      Returns:
      a boolean.
    • containsNode

      boolean containsNode(Node node)

      containsNode.

      Parameters:
      node - a Node object.
      Returns:
      a boolean.
    • deleteFromDocument

      void deleteFromDocument()

      deleteFromDocument.

    • empty

      void empty()

      empty.

    • extend

      void extend(Node node, int offset)

      extend.

      Parameters:
      node - a Node object.
      offset - a Integer object.
    • extend

      void extend(Node node)

      extend.

      Parameters:
      node - a Node object.
    • getRangeAt

      Range getRangeAt(int index)

      getRangeAt.

      Parameters:
      index - a Integer object.
      Returns:
      a Range object.
    • removeAllRanges

      void removeAllRanges()

      removeAllRanges.

    • removeRange

      void removeRange(Range range)

      removeRange.

      Parameters:
      range - a Range object.
    • selectAllChildren

      void selectAllChildren(Node node)

      selectAllChildren.

      Parameters:
      node - a Node object.
    • setBaseAndExtent

      void setBaseAndExtent(Node anchorNode, int anchorOffset, Node focusNode, int focusOffset)

      setBaseAndExtent.

      Parameters:
      anchorNode - a Node object.
      anchorOffset - a Integer object.
      focusNode - a Node object.
      focusOffset - a Integer object.
    • setPosition

      void setPosition(Node node, int offset)

      setPosition.

      Parameters:
      node - a Node object.
      offset - a Integer object.
    • setPosition

      void setPosition(Node node)

      setPosition.

      Parameters:
      node - a Node object.