...
 
Commits (3)
/*
* KSS-RPC v0.17-beta
* KSS-RPC v0.18-beta
*
* Copyright (c) 2017, joonis new media
* Author: Thimo Kraemer <thimo.kraemer@joonis.de>
......@@ -61,7 +61,7 @@
******************************************************************************************/
var kss = {
version: '0.17-beta',
version: '0.18-beta',
_initialized: false,
_ruleSheets: {},
_eventBinders: {},
......@@ -256,6 +256,10 @@ kss._cleanUp = function(purgeAll, observed) {
var bnd = binders[i];
if(purgeAll || !html.contains(bnd.node)) {
bnd.node = null;
if (bnd.binder.cleanUp) {
try { bnd.binder.cleanUp(); }
catch (err) { kss.error(err); }
}
binders.splice(i, 1);
}
}
......@@ -1818,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 : [];
}
......@@ -1832,10 +1836,13 @@ 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');
var found = kss.cssQuery(toNode);
if (!found.length) {
kss.error('Element with selector "' + toNode
+ '" not found to insert nodes');
return;
}
toNode = found[0];
}
if (!kss.isArrayLike(nodes)) {
nodes = [nodes];
......@@ -2403,29 +2410,29 @@ kss.registerActionProvider({
},
// Actions to move content
moveNodeBefore: function(node, params) {
kss.insertNodesBefore(node, params.htmlId);
kss.insertNodesBefore(node, params.target);
},
moveNodeAfter: function(node, params) {
kss.insertNodesAfter(node, params.htmlId);
kss.insertNodesAfter(node, params.target);
},
moveNodeAsFirstChild: function(node, params) {
kss.prependNodes(node, params.htmlId);
kss.prependNodes(node, params.target);
},
moveNodeAsLastChild: function(node, params) {
kss.appendNodes(node, params.htmlId);
kss.appendNodes(node, params.target);
},
// Actions to copy content
copyNodeBefore: function(node, params) {
kss.insertNodesBefore(node, params.htmlId, true);
kss.insertNodesBefore(node, params.target, true);
},
copyNodeAfter: function(node, params) {
kss.insertNodesAfter(node, params.htmlId, true);
kss.insertNodesAfter(node, params.target, true);
},
copyNodeAsFirstChild: function(node, params) {
kss.prependNodes(node, params.htmlId, true);
kss.prependNodes(node, params.target, true);
},
copyNodeAsLastChild: function(node, params) {
kss.appendNodes(node, params.htmlId, true);
kss.appendNodes(node, params.target, true);
},
// Actions to set attributes
setNodeAttr: function(node, params) {
......
This diff is collapsed.