@medv/finder
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -77,3 +77,3 @@ "use strict"; | ||
config = __assign({}, defaults, options); | ||
rootDocument = findRootDocument(config.root); | ||
rootDocument = findRootDocument(config.root, defaults); | ||
var path = bottomUpSearch(input, Limit.All, function () { | ||
@@ -96,4 +96,10 @@ return bottomUpSearch(input, Limit.Two, function () { | ||
exports.default = default_1; | ||
function findRootDocument(rootNode) { | ||
return (rootNode.nodeType === Node.DOCUMENT_NODE) ? rootNode : rootNode.ownerDocument; | ||
function findRootDocument(rootNode, defaults) { | ||
if (rootNode.nodeType === Node.DOCUMENT_NODE) { | ||
return rootNode; | ||
} | ||
if (rootNode === defaults.root) { | ||
return rootNode.ownerDocument; | ||
} | ||
return rootNode; | ||
} | ||
@@ -234,7 +240,7 @@ function bottomUpSearch(input, limit, fallback) { | ||
var i = 0; | ||
while (true) { | ||
while (child) { | ||
if (child.nodeType === Node.ELEMENT_NODE) { | ||
i++; | ||
} | ||
if (child === input || !child.nextSibling) { | ||
if (child === input) { | ||
break; | ||
@@ -241,0 +247,0 @@ } |
{ | ||
"name": "@medv/finder", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "CSS Selector Generator", | ||
@@ -13,3 +13,3 @@ "main": "dist/index.js", | ||
"test": "tsc && ava", | ||
"prepublish": "tsc", | ||
"prepare": "tsc", | ||
"release": "release-it --access public" | ||
@@ -35,3 +35,3 @@ }, | ||
"browser-env": "^3.2.5", | ||
"release-it": "^7.5.0", | ||
"release-it": "^7.6.1", | ||
"typescript": "^3.0.1" | ||
@@ -38,0 +38,0 @@ }, |
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
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
24814
342