node-readability
Advanced tools
Comparing version 0.0.8 to 0.0.9
{ | ||
"name": "node-readability", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"author": "Zihua Li", | ||
@@ -5,0 +5,0 @@ "description": "Turning any web page into a clean view.", |
@@ -195,2 +195,4 @@ // All of the regular expressions in use within readability. | ||
if (topCandidate === null || topCandidate.tagName === "BODY") { | ||
// With no top candidate, bail out if no body tag exists as last resort. | ||
if (!document.body) return new Error("No body tag was found."); | ||
topCandidate = document.createElement("DIV"); | ||
@@ -197,0 +199,0 @@ topCandidate.innerHTML = document.body.innerHTML; |
@@ -1,2 +0,5 @@ | ||
var readability = require('../src/readability'); | ||
var readability = require('../src/readability') | ||
, helpers = require('../src/helpers') | ||
, jsdom = require( 'jsdom' ) | ||
, noBody = '<html><head><title>hi</title></head>hi!</html>'; | ||
require('should'); | ||
@@ -23,3 +26,3 @@ | ||
it('should handle the html that missing body tag', function (done) { | ||
readability.read('<html><head><title>hi</title></head>hi!</html>', function (err, read) { | ||
readability.read(noBody, function (err, read) { | ||
err.message.should.equal('No body tag was found.'); | ||
@@ -29,2 +32,9 @@ done(); | ||
}); | ||
it('should let helpers.grabArticle handle html that\'s missing a body tag', function (done) { | ||
jsdom.env(noBody, [], function (errors, window) { | ||
var err = helpers.grabArticle(window.document); | ||
err.message.should.equal('No body tag was found.'); | ||
done(); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27576
636