We should resync our forked html5 parser package with upstream (https://github.com/aredridel/html5). We've made changes of two types:
- changes to allow us to pass in our tokens directly
- changes to support using domino instead of jsdom.
2b) changes to support using DOM4 instead of DOM3 (because domino only supports DOM4 methods)
It looks like upstream has landed changes to support DOM4 now, so the changes needed upstream to support domino might be very trivial. https://github.com/aredridel/html5/blob/master/lib/html5/parser.js#L2374 has to be changed to allow using domino instead of jsdom, based on options (see https://gerrit.wikimedia.org/r/#/c/49953/3/js/lib/html5/parser.js). domino also doesn't support direct array access to attributes, so a few .item() accessor methods might need to be added, similar to https://gerrit.wikimedia.org/r/49838.