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

main
sam marshall 2019-01-15 14:31:44 +00:00
parent 5958b9dc1b
commit ae110772cf
1 changed files with 3 additions and 2 deletions

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++;