Permalink
Browse files

Fix for when no parser is available

  • Loading branch information...
1 parent bef53ad commit ff109386d2aec3d7a28b3e693536852c9b2a62a0 Jos Shepherd committed Jun 16, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/browser/htmltodom.js
View
@@ -1,6 +1,6 @@
var HtmlToDom = function(parser){
- if(parser.write) {
+ if(parser && parser.write) {
// sax parser
this.appendHtmlToElement = function(html, element){
@@ -42,7 +42,7 @@ var HtmlToDom = function(parser){
return element;
}
- } else if(parser.ParseHtml || parser.DefaultHandler) {
+ } else if(parser && (parser.ParseHtml || parser.DefaultHandler)) {
// Forgiving HTML parser
@@ -82,7 +82,7 @@ var HtmlToDom = function(parser){
} else {
this.appendHtmlToElement = function(){
-
+ var sys = require('sys');
sys.puts('');
sys.puts('###########################################################');
sys.puts('# WARNING: node-htmlparser could not be found.');

0 comments on commit ff10938

Please sign in to comment.