isOrContains function
Returns whether root
is the same as or contains the other
node.
Returns false if either root
or other
is null.
Implementation
bool isOrContains(Element? root, Element? other) => (
(root != null && other != null) &&
(root == other || root.contains(other))
);