|
|
@ -161,7 +161,8 @@ define([], function () {
|
|
|
|
var i = 0, success = false;
|
|
|
|
var i = 0, success = false;
|
|
|
|
// FIXME can't be trusted if element is not found.
|
|
|
|
// FIXME can't be trusted if element is not found.
|
|
|
|
tree.some(ancestor, function (e, index) {
|
|
|
|
tree.some(ancestor, function (e, index) {
|
|
|
|
return (++i, e === el);
|
|
|
|
++i;
|
|
|
|
|
|
|
|
return e === el;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return i;
|
|
|
|
return i;
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -173,21 +174,23 @@ define([], function () {
|
|
|
|
// terminate
|
|
|
|
// terminate
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return (++i === n) ?
|
|
|
|
if (++i === n) {
|
|
|
|
((el = e), true):
|
|
|
|
el = e;
|
|
|
|
false;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return el;
|
|
|
|
return el;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
tree.contains = function (el, ancestor) {
|
|
|
|
tree.contains = function (el, ancestor) {
|
|
|
|
ancestor = ancestor || inner;
|
|
|
|
|
|
|
|
return el && ancestor.contains && ancestor.contains(el);
|
|
|
|
return el && ancestor.contains && ancestor.contains(el);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
tree.check = function (el, ancestor) {
|
|
|
|
tree.check = function (el, ancestor) {
|
|
|
|
return tree.nthFromEnd(Tree.distanceFromEnd(el, ancestor), ancestor) === el;
|
|
|
|
return tree.nthFromEnd(tree.distanceFromEnd(el, ancestor), ancestor) === el;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// TODO see if we can use this
|
|
|
|
// TODO see if we can use this
|
|
|
|