I'd like to use JavaScript to parse an html document into an abstract syntax tree, where each node also includes start and end line numbers (and hopefully also character positions) for each node. Are there any existing solutions that can do this? I don't want to have to write it myself.
Edit Apr 24, 2016: Being able to parse HTML along with php tags in arbitrary places would be even more ideal.