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
pull/1/head
ansuz 9 years ago
parent de46be85ba
commit 39f56d4fd1

@ -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);
}; };

Loading…
Cancel
Save