throw error when checking for the index of a node that has no parent.
it probably isn't in the dom if this is the case. Check if it's there before using this function
This commit is contained in:
@@ -89,6 +89,7 @@ define([], function () {
|
|||||||
var indexOfNode = tree.indexOfNode = function (el) {
|
var indexOfNode = tree.indexOfNode = function (el) {
|
||||||
if (!(el && el.parentNode)) {
|
if (!(el && el.parentNode)) {
|
||||||
console.log("No parentNode found!");
|
console.log("No parentNode found!");
|
||||||
|
throw new Error('No parentNode found!');
|
||||||
}
|
}
|
||||||
return Array.prototype.indexOf.call(el.parentNode.childNodes, el);
|
return Array.prototype.indexOf.call(el.parentNode.childNodes, el);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user