"<ruby><rt>foo</ruby>" works as expected (and the missing </rt> tag is added by the tree builder) but "<ruby><rt>foo</rt></ruby>" crashes the treebuilder:
TypeError: Cannot read property 'tagName' of undefined
at TreeBuilder.b.pop_element (/home/subbu/work/wmf/deploy/node_modules/html5/lib/html5/treebuilder.js:195:43)
at TreeBuilder.b.remove_open_elements_until (/home/subbu/work/wmf/deploy/node_modules/html5/lib/html5/treebuilder.js:187:22)
at Object.endTagOther (/home/subbu/work/wmf/deploy/node_modules/html5/lib/html5/parser.js:2288:10)
at Object.HTML5Parser.phases.base.processEndTag (/home/subbu/work/wmf/deploy/node_modules/html5/lib/html5/parser.js:80:44)
at HTML5Parser.Parser.do_token (/home/subbu/work/wmf/deploy/node_modules/html5/lib/html5/parser.js:2685:17)
"<ruby><rt>foo</ruby>" works as expected (and the missing </rt> tag is added by the tree builder) but "<ruby><rt>foo</rt></ruby>" crashes the treebuilder:
TypeError: Cannot read property 'tagName' of undefined at TreeBuilder.b.pop_element (/home/subbu/work/wmf/deploy/node_modules/html5/lib/html5/treebuilder.js:195:43) at TreeBuilder.b.remove_open_elements_until (/home/subbu/work/wmf/deploy/node_modules/html5/lib/html5/treebuilder.js:187:22) at Object.endTagOther (/home/subbu/work/wmf/deploy/node_modules/html5/lib/html5/parser.js:2288:10) at Object.HTML5Parser.phases.base.processEndTag (/home/subbu/work/wmf/deploy/node_modules/html5/lib/html5/parser.js:80:44) at HTML5Parser.Parser.do_token (/home/subbu/work/wmf/deploy/node_modules/html5/lib/html5/parser.js:2685:17)
Same is true for the </rp> tag.
version 0.3.15 doesn't have this issue. Found via Parsoid's use of html5 (https://gerrit.wikimedia.org/r/#/c/139547/)