aredridel / html5

Event-driven HTML5 Parser in Javascript
http://dinhe.net/~aredridel/projects/js/html5/
MIT License
590 stars 168 forks source link

0.3.16: </rt> and </rp> tags break the the tree builder #109

Closed subbuss closed 10 years ago

subbuss commented 10 years ago

"<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/)

aredridel commented 10 years ago

Cool -- can I get you to edit the issue to show the HTML you mean? Looks like markdown took a bite out of it.

subbuss commented 10 years ago

Fixed now :)

aredridel commented 10 years ago

Thanks! I'll take a look!

aredridel commented 10 years ago

This is fixed in later versions.