Replace localQuery and localQueryAll with a `matches` implementation