MDL-63977 Behat: Fix bug in 'near' calculation

This commit is contained in:
sam marshall
2019-02-11 16:20:42 +00:00
parent e0564a3264
commit d8218a3f09
+3 -2
View File
@@ -306,8 +306,9 @@
var calculateNearDepth = function(node) {
var depth = 0;
while (node) {
if (nearAncestors.indexOf(node) !== -1) {
return depth;
var ancestorDepth = nearAncestors.indexOf(node);
if (ancestorDepth !== -1) {
return depth + ancestorDepth;
}
node = node.parentNode;
depth++;