Skip to content

Conversation

@siddMahen
Copy link
Contributor

Now, if you want to get a dom with options but
without a callback, you can do:

var opts = { .....options..... };
var handler = new htmlparser.DefaultHandler(opts);

instead of:

var handler = new htmlparser.DefaultHandler(function(){}, opts);

which might lead to uncaught errors.

Now, if you want to get a dom with options but
without a callback, you can do:

var opts = { .....options..... };
var handler = new htmlparser.DefaultHandler(opts);

instead of:

var handler = new htmlparser.DefaultHandler(function(){}, opts);

which might lead to uncaught errors.
@fb55
Copy link
Owner

fb55 commented Dec 20, 2011

You may also pass null as the callback, and any error will get thrown. But the idea isn't bad, I just don't like how it was done (it's also dangerous). I prefer to have alternatives as part of the prototype - this is even required if the reset function should be used (happens eg. when you use parseComplete). Otherwise, all options and callbacks would be overwritten.

I'll push a patch soon that implements this in a safe way.

fb55 added a commit that referenced this pull request Dec 20, 2011
@fb55 fb55 closed this Dec 20, 2011
@siddMahen
Copy link
Contributor Author

Thanks for the feedback

fb55 added a commit that referenced this pull request Oct 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants