Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

<source> tags are not parsed properly #50

Open
secretrobotron opened this Issue · 0 comments

1 participant

@secretrobotron

I might be doing the readout wrong, but this is the second time I've picked this up. It seems that <source> isn't identified as a void tag, so they become children of one another when listed inside a <video>:

var htmlparser = require('htmlparser');

var htmlContent = "<html><head></head><body><video><source src=\"foo.ogv\"><source src=\"lol.smaz\"></video><div></div></body></html>";

var handler = new htmlparser.DefaultHandler(function (error, dom) {
  function parse(dom, spacing){
    console.log(spacing, dom.name);
    if(dom.children){
      for(var i=0; i<dom.children.length; ++i){
        parse(dom.children[i], spacing + ' ');
      }
    }
  }
  parse(dom[0], '');
});

new htmlparser.Parser(handler).parseComplete(htmlContent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.