The description of https://codereview.chromium.org/1493023004 sums up my thinking about this issue. The use counters haven't reached stable yet, but it already looks like making it a plain callback function is out of the question:
https://www.chromestatus.com/metrics/feature/timeline/popularity/1059https://www.chromestatus.com/metrics/feature/timeline/popularity/1060
That's a shame, because this doesn't API doesn't make sense, see the third paragraph of the CL description.
I think that one possible fix would be split NodeFilter into a plain NodeFilter interface with only the contants and a NodeFilterCallback with only acceptNode. I'll probably come back to this issue once the use counter data from stable is in.
While chromstatus.com is not updating, Rick helped me check usage from the stable channel internally:
NodeFilterIsFunction - 0.82%
NodeFilterIsObject - 0.039%
As expected, making this a plain callback function is out of the question, the current behavior needs to be preserved. I'll file a spec bug.
And I've closed the issue already. At this point it doesn't seem like there's any meaningful simplification to be done here. The special thing here is the NodeFilter interface object. I haven't dug into all of the details, but WebIDL seems to define it detail, with the most interesting bits in http://heycam.github.io/webidl/#es-interfaces
I'll fix the followings separately.
- .filter should return values specified to createNodeIterator()/createTreeWalker()
- NodeFilter should be a legacy callback interface
Comment 1 by phil...@opera.com
, Mar 4 2016