Commit 15024258 by Thimo Kraemer

Changed some error handling

parent d4eefb3e
......@@ -257,7 +257,8 @@ kss._cleanUp = function(purgeAll, observed) {
if(purgeAll || !html.contains(bnd.node)) {
bnd.node = null;
if (bnd.binder.cleanUp) {
bnd.binder.cleanUp();
try { bnd.binder.cleanUp(); }
catch (err) { kss.error(err); }
}
binders.splice(i, 1);
}
......@@ -1821,7 +1822,7 @@ kss.cssQuery = function(selector, context, dropContext) {
}
break;
default:
throw new Error('invalid selector "' + selector + '"');
kss.error('invalid selector "' + selector + '"');
}
return result[0] ? result : [];
}
......@@ -1835,10 +1836,14 @@ kss.cssQuery = function(selector, context, dropContext) {
kss.insertNodes = function(nodes, toNode, position, copy) {
if (typeof toNode == 'string') {
toNode = document.getElementById(toNode);
if (!toNode) {
throw new Error('Target element not found to insert nodes');
toNode = toNode.split('#').pop();
var node = document.getElementById(toNode);
if (!node) {
kss.error('Element with id "#' + toNode
+ '" not found to insert nodes');
return;
}
toNode = node;
}
if (!kss.isArrayLike(nodes)) {
nodes = [nodes];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment