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:
parent
de46be85ba
commit
39f56d4fd1
1 changed files with 1 additions and 0 deletions
|
@ -89,6 +89,7 @@ define([], function () {
|
|||
var indexOfNode = tree.indexOfNode = function (el) {
|
||||
if (!(el && el.parentNode)) {
|
||||
console.log("No parentNode found!");
|
||||
throw new Error('No parentNode found!');
|
||||
}
|
||||
return Array.prototype.indexOf.call(el.parentNode.childNodes, el);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue