You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The findOne helper is meant to recursively find an element in a tree that passes the provided test function. However, the implementation is written such that the function will return the result of the search through the first node that has any children, regardless of whether a passing element was found in that branch.
This happens because the paragraph has children, so the current implementation of findOne enters that recursion branch and returns regardless of the result.
The text was updated successfully, but these errors were encountered:
zachsents
added a commit
to zachsents/domutils
that referenced
this issue
Dec 31, 2024
The
findOne
helper is meant to recursively find an element in a tree that passes the provided test function. However, the implementation is written such that the function will return the result of the search through the first node that has any children, regardless of whether a passing element was found in that branch.See the implementation here. The problem occurs on Line 115.
Consider the tree:
When searching for the paragraph, it's successful:
When searching for the bold tag, however, it fails:
This happens because the paragraph has children, so the current implementation of
findOne
enters that recursion branch and returns regardless of the result.The text was updated successfully, but these errors were encountered: