The main idea is that we keep a copy of the tree, and then use an
array to keep track of matches. To handle a list of selectors (using
the comma separator), we have to track both the currently progressing
match and the previously matched elements.
To use this handler: