incubator-annotator icon indicating copy to clipboard operation
incubator-annotator copied to clipboard

Add convenience matcher functions to dom package

Open Treora opened this issue 3 years ago • 0 comments

We have discussed similar APIs before, to make the common use cases easier.

  • createAnySelectorMatcher mimics the signature of existing matcher creators, but works on any selector type we support. For tools that try to maximise interoperability, matching a selector of any supported type should be easy; checking the type and using the right matcher is a task we can do for the user.

  • matchSelector wraps the this to make the common use case easy, hiding the generator and returning an array instead. Until they get advanced needs, a user should not have to care about async generators and curried functions to anchor a selector. Especially so as our highlighter messes up the matcher when used before the latter is finished (see issue #112).

Note this code depends on (and already includes the commits of) #136 and #137.

When trying to run yarn start, I get an error about missing imports, so probably I messed something up still..

Treora avatar Nov 23 '22 22:11 Treora