No DefaultHandler in master branch? #57

Open
ghost opened this Issue Oct 6, 2012 · 2 comments

Projects

None yet

2 participants

@ghost
ghost commented Oct 6, 2012

I don't know whether I'm missing something or not, please tell me if I do and excuse me if this is too obvious but there is no DefaultHandler method of htmlparser object in master branch (version 2.0.0).
I've tried using this library in my browser but when I inspect htmlparser (Tautologistics.NodeHtmlParser) object, it doesn't have such a method. However it works like a charm in 1.x version!
is there something missing from this branch? or I'm missing something?
Thanks in advance.

@philipwalton

I just ran into the same issue. I'm not sure where to go from here.

@dmitris
dmitris commented Feb 12, 2013

I think you want to use HtmlBuilder instead - in the utils_example.js, I change
var handler = new htmlparser.DefaultHandler(function(err, dom) {
which produces a somewhat cryptic error
var handler = new htmlparser.DefaultHandler(function(err, dom) { ^ TypeError: undefined is not a function
to the following:
var handler = new htmlparser.HtmlBuilder(function(err, dom) {
and it works like a charm (though in that example you also need to change the variable 'class' which collides with the reserved keyword)

@AndreasMadsen AndreasMadsen referenced this issue in AndreasMadsen/htmlparser2 Jul 31, 2013
@fb55 fb55 [parser] default options & cbs to empty objects
fixes #57
b00177f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment