fonto:selection-in-node

Type: Function

This function will return true() if and only if both edges of the global selection are in a node, or in a descendant of a node.

Thus, it will return true in the following cases:

Other

    A
    |
    B
   / \
  C   D
 / \
E   F <----- Selection end, in C, just after F
  ^---- Selection start, in C, just before F

Input

Result

A

true()

B

true()

C

true()

D

false()

E

false()

F

false()

This function will invalidate itself when the selection is moved to outside or to inside a node. It can also be used to assign different families to an element depending whether it contains the selection or not. Mind performance when doing this.

Other

if (fonto:selection-in-node($data?contextNode)) then
    "Selection is in node"
else
    "Selection is not in node"

Arguments

  1. node

    (Required)

    Type: Node

    The node to check

Returns

Type: Boolean

Whether the selection is inside that node