tmpvar/jsdom — Issue #370: Pluggable parsers
Author: tmpvar
Created: 2011-11-25 18:23:19+00:00
State: open
Labels: feature, NEEDS TESTS, parsing

parsers that have had adapters created for them

```javascript
jsdom.env('html', {
parser : "htmlparser"
})
```

parsers that have not had adapters created for them or want to be used externally

```javascript
jsdom.env('html', {
parser : new Parser()
})
```

where `Parser` follows the API

```javascript

Parser = {
jsdom : {
fragment(element, markup) {
// return an array of errors or null
},
document : function(document, markup) {
// return an array of errors or null
},
stream : function(document, stream, fn) {
// fn is called on completion with an argument: errors (array/null)
}
}
};

```

jsdom throws a ton of exceptions and parsers need to be able to recover from them. Errors need be reported, but parsing should continue to completion.