Comparing version 2.1.1 to 2.1.2
@@ -0,0 +0,0 @@ var paths = { |
@@ -0,0 +0,0 @@ --- |
{ | ||
"name": "tocbot", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Generate a table of contents based on the heading structure of a html document.", | ||
@@ -5,0 +5,0 @@ "main": "src/js/index.js", |
@@ -181,2 +181,8 @@ <h1 class="display--none"> | ||
### v2.1.2 | ||
#### Fixed | ||
- [patch] prevent errors from being thrown when elements are not present and add tests. | ||
### v2.1.1 | ||
@@ -183,0 +189,0 @@ |
@@ -0,0 +0,0 @@ module.exports = { |
@@ -0,0 +0,0 @@ var path = require('path'); |
@@ -0,0 +0,0 @@ var fs = require('fs'); |
@@ -0,0 +0,0 @@ var path = require('path'); |
@@ -48,2 +48,7 @@ /** | ||
// Return if no parent is found. | ||
if (parent === null) { | ||
return; | ||
} | ||
// Remove existing child if it exists. | ||
@@ -50,0 +55,0 @@ if (parent.firstChild) { |
@@ -0,0 +0,0 @@ /** |
@@ -141,4 +141,8 @@ /** | ||
// Get headings array | ||
// Get headings array. | ||
headingsArray = parseContent.selectHeadings(options.contentSelector, options.headingSelector); | ||
// Return if no headings are found. | ||
if (headingsArray === null) { | ||
return; | ||
} | ||
@@ -145,0 +149,0 @@ // Build nested headings array. |
@@ -95,2 +95,3 @@ /** | ||
console.warn('Element not found: ' + contentSelector); // eslint-disable-line | ||
return null; | ||
} | ||
@@ -97,0 +98,0 @@ } |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ module.exports = function() { |
@@ -80,2 +80,18 @@ var fs = require('fs'); | ||
}); | ||
it('should not throw an error if a content element isn\'t found', function () { | ||
GLOBAL.window.tocbot.destroy(); | ||
expect(GLOBAL.window.tocbot.init).to.not.throw(Error); | ||
GLOBAL.window.tocbot.init({ | ||
tocSelector: '.missing' | ||
}); | ||
}); | ||
it('should not throw an error if a toc element isn\'t found', function () { | ||
GLOBAL.window.tocbot.destroy(); | ||
expect(GLOBAL.window.tocbot.init).to.not.throw(Error); | ||
GLOBAL.window.tocbot.init({ | ||
contentSelector: '.not-here' | ||
}); | ||
}); | ||
}); | ||
@@ -82,0 +98,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
91347
1247
247