isInTree method
Returns true
if key
is in the tree.
Implementation
@override
bool isInTree(Node? key) {
if (key == null) return false;
var rootConn = root.isConnected;
var keyConn = key.isConnected;
// Optimization: If `rootConn` and `keyConn` differ,
// `root` and `key` cannot be in the same DOM tree:
if (rootConn != keyConn) {
return false;
} else {
return root.contains(key);
}
}