Created
May 24, 2010 16:15
-
-
Save aredridel/412074 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Proposed API for HTML5 parser in Javascript | |
var HTML5 = require('html5') | |
HTML5.parse(string, [{DOM: domModule}]) -> DOM objects | |
new HTML5.Parser(source, [{DOM: domModule}]) -> eventEmitter with "document" property. emits "end" when fully parsed, and the document property is a DOM tree | |
Internal: | |
new HTML5.Tokenizer(source) -> eventEmitter that emits 'token' for each token and 'end' when done. This isn't useful outside the parser since the tokenizer needs feedback from the parser. | |
The Tokenizer has a "state" property that is the name of the function to call for the current tokenizer state. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment