How searching in elements works
masterMethods like find(), first(), xpath(), has(), and count() are available on both Document and Element instances, allowing for scoped searches.
Scoped vs. Global Search
When you call find() on an Element, DiDOM creates a new document context for that search. This means if you attempt to modify or remove an element found via a scoped search, the changes might not reflect in the original document.
To ensure modifications (like remove()) affect the original document, use the InDocument variants:
findInDocument()firstInDocument()
Warning: These methods only work for elements that belong to a document or were created via new Element(...). Otherwise, a LogicException is thrown.