getMappedElement method

T? getMappedElement(
  1. DOMNode? domNode, {
  2. bool checkParents = false,
})

Returns the mapped element T associated with domNode.

checkParents If true, also checks for mapped domNode.parent.

Implementation

T? getMappedElement(DOMNode? domNode, {bool checkParents = false}) {
  if (domNode == null) return null;
  var element = _domNodeToElementMap[domNode];
  if (element != null) return element;

  if (!checkParents) return null;

  var parent = domNode.parent;
  return getMappedElement(parent, checkParents: true);
}