In the Walker code, this.enter gets set to false unnecessarily early if the node has no children. This causes it to skip the if branch which would otherwise cause the filter to run a second time for exit, and move straight to advancing to the parent node.
In applyFilterPartToNode, the exit filter will be run if enter == false OR if !("enter" in trans). But it should only run in the first case, NOT the second. This commit refactors the code to prevent the exit filter from running twice in the case that no enter filter is defined.
There are two related changes here:
In the
Walker
code,this.enter
gets set to false unnecessarily early if the node has no children. This causes it to skip theif
branch which would otherwise cause the filter to run a second time forexit
, and move straight to advancing to the parent node.In
applyFilterPartToNode
, theexit
filter will be run ifenter == false
OR if!("enter" in trans)
. But it should only run in the first case, NOT the second. This commit refactors the code to prevent theexit
filter from running twice in the case that noenter
filter is defined.A test has been added to check for this.