[KSS-checkins] r45752 - kukit/kukit.js/trunk/kukit
gotcha at codespeak.net
gotcha at codespeak.net
Thu Aug 16 22:32:23 CEST 2007
Author: gotcha
Date: Thu Aug 16 22:32:22 2007
New Revision: 45752
Modified:
kukit/kukit.js/trunk/kukit/actionreg.js
kukit/kukit.js/trunk/kukit/commandprocessor.js
kukit/kukit.js/trunk/kukit/commandreg.js
kukit/kukit.js/trunk/kukit/dom.js
kukit/kukit.js/trunk/kukit/errors.js
kukit/kukit.js/trunk/kukit/eventreg.js
kukit/kukit.js/trunk/kukit/forms.js
kukit/kukit.js/trunk/kukit/kssparser.js
kukit/kukit.js/trunk/kukit/kukit.js
kukit/kukit.js/trunk/kukit/oper.js
kukit/kukit.js/trunk/kukit/plugin.js
kukit/kukit.js/trunk/kukit/providerreg.js
kukit/kukit.js/trunk/kukit/requestmanager.js
kukit/kukit.js/trunk/kukit/resourcedata.js
kukit/kukit.js/trunk/kukit/selectorreg.js
kukit/kukit.js/trunk/kukit/serveraction.js
kukit/kukit.js/trunk/kukit/tokenizer.js
kukit/kukit.js/trunk/kukit/utils.js
Log:
merge gotcha-code-cleanup
Modified: kukit/kukit.js/trunk/kukit/actionreg.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/actionreg.js (original)
+++ kukit/kukit.js/trunk/kukit/actionreg.js Thu Aug 16 22:32:22 2007
@@ -1,9 +1,6 @@
/*
-* Copyright (c) 2005-2006
-* Authors:
-* Godefroid Chapelle <gotcha at bubblenet.be>
-* Florian Schulze <florian.schulze at gmx.net>
-* Balázs Reé <ree at greenfinity.hu>
+* Copyright (c) 2005-2007
+* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -32,12 +29,14 @@
};
kukit.ar.ActionRegistry.prototype.register = function(name, func) {
- ;;; if (typeof(func) == 'undefined') {
- ;;; throw 'func argument is mandatory when registering an action (ActionRegistry.register).';
- ;;; }
+;;; if (typeof(func) == 'undefined') {
+;;; kukit.E = '[func] argument is mandatory when registering an action';
+;;; kukit.E += ' [ActionRegistry.register].';
+;;; throw kukit.E;
+;;; }
if (this.content[name]) {
// Do not allow redefinition
- ;;; kukit.logError('Error : action "' + name + '" already registered.');
+;;; kukit.logError('Error : action [' + name + '] already registered.');
return;
}
this.content[name] = func;
@@ -52,9 +51,8 @@
var func = this.content[name];
if (! func) {
// not found
- ;;; kukit.E = 'Error : undefined local action "' + name + '"';
+;;; kukit.E = 'Error : undefined local action [' + name + '].';
throw kukit.E;
- //kukit.logError(kukit.E);
}
return func;
};
@@ -66,7 +64,9 @@
kukit.ar.actionRegistry = {};
kukit.ar.actionRegistry.register = function(name, func) {
- ;;; kukit.logWarning('Deprecated kukit.ar.actionRegistry.register, use kukit.actionsGlobalRegistry.register instead! (' + name + ')');
+;;; var msg='Deprecated kukit.ar.actionRegistry.register, use ';
+;;; msg += 'kukit.actionsGlobalRegistry.register instead !';
+;;; kukit.logWarning(msg);
kukit.actionsGlobalRegistry.register(name, func);
};
Modified: kukit/kukit.js/trunk/kukit/commandprocessor.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/commandprocessor.js (original)
+++ kukit/kukit.js/trunk/kukit/commandprocessor.js Thu Aug 16 22:32:22 2007
@@ -1,9 +1,6 @@
/*
-* Copyright (c) 2005-2006
-* Authors:
-* Godefroid Chapelle <gotcha at bubblenet.be>
-* Florian Schulze <florian.schulze at gmx.net>
-* Balázs Reé <ree at greenfinity.hu>
+* Copyright (c) 2005-2007
+* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -29,9 +26,10 @@
this.commands = new Array();
};
-kukit.cp.CommandProcessor.prototype.parseCommands = function(commands, transport) {
- ;;; kukit.log('Parse commands');
- ;;; kukit.logDebug('Number of commands: ' + commands.length);
+kukit.cp.CommandProcessor.prototype.parseCommands =
+ function(commands, transport) {
+;;; kukit.log('Parsing commands.');
+;;; kukit.logDebug('Number of commands : ' + commands.length + '.');
for (var y=0;y < commands.length;y++) {
var command = commands[y];
this.parseCommand(command, transport);
@@ -41,13 +39,14 @@
// we make sure we execute none of them.
var lastcommand = this.commands[this.commands.length-1];
if (lastcommand.name == 'error') {
- ;;; kukit.E = new kukit.err.ExplicitError(lastcommand);
+;;; kukit.E = new kukit.err.ExplicitError(lastcommand);
throw kukit.E;
}
}
};
-kukit.cp.CommandProcessor.prototype.parseCommand = function(command, transport) {
+kukit.cp.CommandProcessor.prototype.parseCommand =
+ function(command, transport) {
var selector = "";
var params = {};
var name = "";
@@ -64,7 +63,8 @@
continue;
if (childNode.localName) {
// (here tolerate both cases)
- if (childNode.localName.toLowerCase() != "param" && childNode.nodeName.toLowerCase() != "kukit:param") {
+ if (childNode.localName.toLowerCase() != "param"
+ && childNode.nodeName.toLowerCase() != "kukit:param") {
throw 'Bad payload, expected param';
}
} else {
@@ -93,7 +93,8 @@
throw 'Bad payload, expected attribute "name"';
}
}
- var command = new kukit.cr.makeCommand(selector, name, type, params, transport);
+ var command = new kukit.cr.makeCommand(selector, name, type, params,
+ transport);
this.addCommand(command);
};
@@ -103,7 +104,7 @@
kukit.cp.CommandProcessor.prototype.executeCommands = function(oper) {
kukit.engine.beginSetupEventsCollection();
- // node, eventrule, binderinstance are given on oper, in case
+ // node, eventRule, binderInstance are given on oper, in case
// the command was called up from an event
if (typeof(oper) == 'undefined' || oper == null) {
oper = new kukit.op.Oper();
@@ -111,16 +112,16 @@
var commands = this.commands;
for (var y=0;y < commands.length;y++) {
var command = commands[y];
- ;;; try {
+;;; try {
command.execute(oper);
- ;;; } catch (e) {
- ;;; if (e.name == 'RuleMergeError' || e.name == 'EventBindError') {
- ;;; throw(e);
- ;;; } else {
- ;;; // augment the error message
- ;;; throw new kukit.err.CommandExecutionError(e, command);
- ;;; }
- ;;; }
+;;; } catch (e) {
+;;; if (e.name == 'RuleMergeError' || e.name == 'EventBindError') {
+;;; throw(e);
+;;; } else {
+;;; // augment the error message
+;;; throw new kukit.err.CommandExecutionError(e, command);
+;;; }
+;;; }
}
kukit.engine.finishSetupEventsCollection();
};
Modified: kukit/kukit.js/trunk/kukit/commandreg.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/commandreg.js (original)
+++ kukit/kukit.js/trunk/kukit/commandreg.js Thu Aug 16 22:32:22 2007
@@ -1,9 +1,6 @@
/*
-* Copyright (c) 2005-2006
-* Authors:
-* Godefroid Chapelle <gotcha at bubblenet.be>
-* Florian Schulze <florian.schulze at gmx.net>
-* Balázs Reé <ree at greenfinity.hu>
+* Copyright (c) 2005-2007
+* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -38,14 +35,18 @@
* Examples:
*
* kukit.actionsGlobalRegistry.register('log', f1);
-* kukit.commandsGlobalRegistry.registerFromAction('log', kukit.cr.makeGlobalCommand);
+* kukit.commandsGlobalRegistry.registerFromAction('log',
+* kukit.cr.makeGlobalCommand);
*
* kukit.actionsGlobalRegistry.register('replaceInnerHTML', f2);
-* kukit.commandsGlobalRegistry.registerFromAction('replaceInnerHTML', kukit.cr.makeSelectorCommand);
+* kukit.commandsGlobalRegistry.registerFromAction('replaceInnerHTML',
+* kukit.cr.makeSelectorCommand);
*/
-kukit.cr.CommandRegistry.prototype.registerFromAction = function(srcname, factory, name) {
+kukit.cr.CommandRegistry.prototype.registerFromAction =
+ function(srcname, factory, name) {
if (typeof(name) == 'undefined') {
- // allows to set a different name as the action name, usable for backward
+ // allows to set a different name as the action name,
+ // usable for backward
// compatibility setups
name = srcname;
}
@@ -57,7 +58,8 @@
kukit.cr.CommandRegistry.prototype.register = function(name, klass) {
if (this.commands[name]) {
// Do not allow redefinition
- ;;; kukit.logError('ValueError : command "' + name + '" is already registered.');
+;;; var msg = 'ValueError : command [' + name + '] is already registered.';
+;;; kukit.logError(msg);
return;
}
this.commands[name] = klass;
@@ -65,10 +67,11 @@
kukit.cr.CommandRegistry.prototype.get = function(name) {
var klass = this.commands[name];
- ;;; if (! klass) {
- ;;; // not found
- ;;; kukit.logError('ValueError : no command registered under name : ' + name);
- ;;; }
+;;; if (! klass) {
+;;; // not found
+;;; var msg = 'ValueError : no command registered under [' + name + '].';
+;;; kukit.logError(msg);
+;;; }
return klass;
};
@@ -79,7 +82,10 @@
kukit.cr.commandRegistry = {};
kukit.cr.commandRegistry.registerFromAction = function(srcname, factory, name) {
- ;;; kukit.logWarning('Deprecated kukit.cr.commandRegistry.registerFromAction, use kukit.commandsGlobalRegistry.registerFromAction instead! (' + srcname + ')');
+;;; var msg = 'Deprecated kukit.cr.commandRegistry.registerFromAction,';
+;;; msg += ' use kukit.commandsGlobalRegistry.registerFromAction instead! (';
+;;; msg += srcname + ')';
+;;; kukit.logWarning(msg);
kukit.commandsGlobalRegistry.registerFromAction(srcname, factory, name);
};
@@ -110,20 +116,24 @@
// When applying the selection, the original event target will be used
// as a starting point for the selection.
var nodes = selfunc(this.selector, oper.orignode, {});
- ;;; var printtype;
- ;;; if (this.selectorType) {
- ;;; printtype = this.selectorType;
- ;;; } else {
- ;;; printtype = 'default (' + kukit.selectorTypesGlobalRegistry.defaultSelectorType + ')';
- ;;; }
- ;;; kukit.logDebug('Selector type: ' + printtype + ', selector : "' + this.selector + '", selected nodes:' + nodes.length);
- ;;; if (!nodes || nodes.length == 0) {
- ;;; kukit.logWarning('Selector found no nodes');
- ;;; }
+;;; var printType;
+;;; if (this.selectorType) {
+;;; printType = this.selectorType;
+;;; } else {
+;;; printType = 'default (';
+;;; printType += kukit.selectorTypesGlobalRegistry.defaultSelectorType;
+;;; printType += ')';
+;;; }
+;;; var msg = 'Selector type [' + printType + '], selector [';
+;;; msg += this.selector + '], selected nodes [' + nodes.length + '].';
+;;; kukit.logDebug(msg);
+;;; if (!nodes || nodes.length == 0) {
+;;; kukit.logWarning('Selector found no nodes.');
+;;; }
for (var i=0;i < nodes.length;i++) {
oper.node = nodes[i];
//XXX error handling for wrong command name
- ;;; kukit.logDebug('Command Name: ' + this.name);
+;;; kukit.logDebug('[' + this.name + '] execution.');
this.executeOnSingleNode(oper);
}
};
Modified: kukit/kukit.js/trunk/kukit/dom.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/dom.js (original)
+++ kukit/kukit.js/trunk/kukit/dom.js Thu Aug 16 22:32:22 2007
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2005-2007
-* Authors: KSS Project Contributors (see docs/CREDITS.txt)
+* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -38,23 +38,27 @@
};
kukit.dom.insertBefore = function(nodeFrom, parentNode, nodeTo) {
- var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;
+ var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ?
+ nodeTo : nodeTo.ownerDocument;
var nodes = nodeFrom.childNodes;
var result = new Array();
if(ownerDoc.importNode && (!kukit.HAVE_IE)) {
for(var i=0;i < nodes.length;i++) {
- result[i] = parentNode.insertBefore(ownerDoc.importNode(nodes[i], true), nodeTo);
+ var imported = ownerDoc.importNode(nodes[i], true);
+ result[i] = parentNode.insertBefore(imported, nodeTo);
}
} else {
for(var i=0;i < nodes.length;i++) {
- result[i] = parentNode.insertBefore(nodes[i].cloneNode(true), nodeTo);
+ var cloned = nodes[i].cloneNode(true);
+ result[i] = parentNode.insertBefore(cloned, nodeTo);
}
}
return result;
};
kukit.dom.appendChildren = function(nodes, toNode) {
- var ownerDoc = toNode.nodeType == Node.DOCUMENT_NODE ? toNode : toNode.ownerDocument;
+ var ownerDoc = toNode.nodeType == Node.DOCUMENT_NODE ?
+ toNode : toNode.ownerDocument;
var result = new Array();
if(ownerDoc.importNode && (!kukit.HAVE_IE)) {
for(var i=0;i < nodes.length;i++) {
@@ -79,21 +83,29 @@
// This is to assure that all methods that accept a dom can accept a string
// instead.
if (typeof(param) == 'string') {
- //
- // now convert to dom
- //
-
- //param = "<option>test_xmlentity</option><option>tic</option><option>tac toe</option>";
- // ***BROKEN*** param = "<option>test_htmlentity</option><option>tic</option><option>tac toe</option>";
- //param = "<option>test_utf8</option><option>tic</option><option>tacűtoe</option>";
-
- // This is a good solution since it does not do magic to
- // our html - BUT html is parsed as xml
- // so we currently preprocess it on the server
- // and remove html named entities from it.
- //
- var root_txt = '<html xmlns="http://www.w3.org/1999/xhtml"><div>' + param + '</div></html>';
- var doc = (new DOMParser()).parseFromString(root_txt, "text/xml");
+//
+// now convert to dom
+//
+
+// param
+// <option>test_xmlentity</option><option>tic</option>
+// <option>tac toe</option>
+
+// ***BROKEN*** param
+// <option>test_htmlentity</option><option>tic</option>
+// <option>tac toe</option>
+
+// param
+// <option>test_utf8</option><option>tic</option><option>tacűtoe</option>
+
+// This is a good solution since it does not do magic to
+// our html - BUT html is parsed as xml
+// so we currently preprocess it on the server
+// and remove html named entities from it.
+//
+ var rootText = '<html xmlns="http://www.w3.org/1999/xhtml"><div>';
+ rootText += param + '</div></html>';
+ var doc = (new DOMParser()).parseFromString(rootText, "text/xml");
var root = doc.getElementsByTagName('div')[0];
// XXX Sarissa bug; html docs would not have a
@@ -118,36 +130,36 @@
/*
* really the query should start from the document root, but
-* limited to in_nodes subtrees!
+* limited to inNodes subtrees!
*/
-kukit.dom.cssQuery = function(selector, in_nodes) {
+kukit.dom.cssQuery = function(selector, inNodes) {
// to eliminate possible errors
- if (typeof(in_nodes) != 'undefined' && in_nodes == null) {
- ;;; kukit.E = 'Selection error in kukit.dom.cssQuery';
+ if (typeof(inNodes) != 'undefined' && inNodes == null) {
+;;; kukit.E = 'Selection error in kukit.dom.cssQuery';
throw kukit.E;
}
- return kukit.dom._cssQuery(selector, in_nodes);
+ return kukit.dom._cssQuery(selector, inNodes);
};
/*
* Decide which query to use
*/
-kukit.dom._cssQuery = function(selector, in_nodes) {
+kukit.dom._cssQuery = function(selector, inNodes) {
var USE_BASE2 = (typeof(base2) != 'undefined');
if (USE_BASE2) {
- ;;; kukit.log('Using cssQuery from base2');
+;;; kukit.log('Using cssQuery from base2.');
kukit.dom._cssQuery = kukit.dom._cssQuery_base2
} else {
- ;;; kukit.log('Using original cssQuery');
+;;; kukit.log('Using original cssQuery.');
kukit.dom._cssQuery = kukit.dom._cssQuery_orig
}
- return kukit.dom._cssQuery(selector, in_nodes);
+ return kukit.dom._cssQuery(selector, inNodes);
};
-kukit.dom._cssQuery_base2 = function(selector, in_nodes) {
+kukit.dom._cssQuery_base2 = function(selector, inNodes) {
// global scope, always.
// This is very bad. However the binding makes sure that
// nodes once bound will never be bound again
@@ -161,7 +173,7 @@
return nodes;
};
-kukit.dom._cssQuery_orig = function(selector, in_nodes) {
+kukit.dom._cssQuery_orig = function(selector, inNodes) {
// global scope, always.
// This is very bad. However the binding makes sure that
// nodes once bound will never be bound again
@@ -173,10 +185,11 @@
kukit.dom.focus = function(node) {
tagName = node.tagName.toLowerCase();
- if ((tagName == 'input') || (tagName == 'select') || (tagName == 'textarea')) {
+ if ((tagName == 'input') || (tagName == 'select')
+ || (tagName == 'textarea')) {
node.focus();
- ;;; } else {
- ;;; kukit.logWarning('Focus on node that cannot have focus !');
+;;; } else {
+;;; kukit.logWarning('Focus on node that cannot have focus !');
}
};
@@ -219,9 +232,9 @@
if (attrname.toLowerCase() == 'style') {
throw 'Style attribute is not allowed with getAttribute';
}
- ;;;if (typeof(attrname) != 'string') {
- ;;; throw 'value error : attrname must be string';
- ;;;}
+;;; if (typeof(attrname) != 'string') {
+;;; throw 'value error : attrname must be string';
+;;; }
// The code hereunder does not work for kssattr:xxx args
// var value = node[argname];
@@ -293,9 +306,11 @@
for (var i=0; i<splitclass.length; i++) {
var elem = splitclass[i];
var splitelem = elem.split('-', 3);
- if (splitelem.length == 3 && splitelem[0] == kukit.dom.kssAttrNamespace
+ if (splitelem.length == 3 &&
+ splitelem[0] == kukit.dom.kssAttrNamespace
&& splitelem[1] == attrname) {
- // Found it. (The last one will be valid, in case of duplication)
+ // Found it. (The last one will be valid,
+ // in case of duplication)
var index = splitelem[0].length + splitelem[1].length + 2;
result = elem.substr(index);
}
@@ -308,9 +323,12 @@
kukit.dom.getKssAttribute = function(node, attrname) {
// Gets a given kss attribute
// first from the namespace, then from the class
- var result = kukit.dom.getAttribute(node, kukit.dom.kssAttrNamespace + ':' + attrname);
- // XXX if this was '' it is the same as notfound, so it shadows the class attribute!
- // This means setting an attribute to '' is the same as deleting it - at the moment
+ var fullName = kukit.dom.kssAttrNamespace + ':' + attrname;
+ var result = kukit.dom.getAttribute(node, fullName);
+ // XXX if this was '' it is the same as notfound,
+ // so it shadows the class attribute!
+ // This means setting an attribute to '' is the same as deleting it -
+ // at least at the moment
if (! result) {
result = kukit.dom.getKssClassAttribute(node, attrname);
}
@@ -319,18 +337,21 @@
kukit.dom.setKssAttribute = function(node, attrname, value) {
// Sets a given kss attribute on the namespace
- kukit.dom.setAttribute(node, kukit.dom.kssAttrNamespace + ':' + attrname, value);
+ var fullName = kukit.dom.kssAttrNamespace + ':' + attrname;
+ kukit.dom.setAttribute(node, fullName);
};
/* Recursive getting of node attributes
getter is a function that gets the value from the node.
*/
-kukit.dom.getRecursiveAttribute = function(node, attrname, recurseParents, getter) {
+kukit.dom.getRecursiveAttribute =
+ function(node, attrname, recurseParents, getter) {
var value = getter(node, attrname);
if (recurseParents) {
var element = node;
- // need to recurse even if value="" ! We cannot figure out if there exists
+ // need to recurse even if value="" !
+ // We cannot figure out if there exists
// and attribute in a crossbrowser way, or it is set to "".
while (! value) {
element = element.parentNode;
@@ -354,7 +375,8 @@
*
* Scheduler for embedded window content loaded
*/
-kukit.dom.EmbeddedContentLoadedScheduler = function(framename, func, autodetect) {
+kukit.dom.EmbeddedContentLoadedScheduler =
+ function(framename, func, autodetect) {
this.framename = framename;
this.func = func;
this.autodetect = autodetect;
@@ -385,16 +407,19 @@
kukit.dom.EmbeddedContentLoadedScheduler.prototype.check = function() {
- ;;; kukit.logDebug('Is iframe loaded ?');
+;;; kukit.logDebug('Is iframe loaded ?');
var doc = kukit.dom.getIframeDocument(this.framename);
// quit if the init function has already been called
// XXX I believe we want to call the function too, then
- // XXX attribute access starting with _ breaks full compression, even in strings
+ // XXX attribute access starting with _ breaks full compression,
+ // even in strings
//if (doc._embeddedContentLoadedInitDone) {
if (doc['_' + 'embeddedContentLoadedInitDone']) {
- ;;; kukit.logWarning('Iframe already initialized, but we execute the action anyway, as requested.');
+;;; var msg = 'Iframe already initialized, but we execute the action';
+;;; msg += ' anyway, as requested.';
+;;; kukit.logWarning(msg);
this.counter.restart = false;
}
@@ -404,7 +429,8 @@
// on the document, when loaded. It is safe to check for this in any
// case, however if this option is selected, we rely only on this,
// and skip the otherwise problematic default checking.
- // XXX attribute access starting with _ breaks full compression, even in strings
+ // XXX attribute access starting with _ breaks full compression,
+ // even in strings
//if (typeof doc._kssReadyForLoadEvent != 'undefined') {
if (typeof doc['_' + 'kssReadyForLoadEvent'] != 'undefined') {
this.counter.restart = false;
@@ -418,23 +444,28 @@
} /* */
// First check for Safari or
- //if DOM methods are supported, and the body element exists
- //(using a double-check including document.body, for the benefit of older moz builds [eg ns7.1]
- //in which getElementsByTagName('body')[0] is undefined, unless this script is in the body section)
+ // if DOM methods are supported, and the body element exists
+ // (using a double-check including document.body,
+ // for the benefit of older moz builds [eg ns7.1]
+ // in which getElementsByTagName('body')[0] is undefined,
+ // unless this script is in the body section)
if(/KHTML|WebKit/i.test(navigator.userAgent)) {
if(/loaded|complete/.test(doc.readyState)) {
this.counter.restart = false;
}
- } else if(typeof doc.getElementsByTagName != 'undefined' && (doc.getElementsByTagName('body')[0] != null || doc.body != null)) {
+ } else if(typeof doc.getElementsByTagName != 'undefined'
+ && (doc.getElementsByTagName('body')[0] != null ||
+ doc.body != null)) {
this.counter.restart = false;
} /* */
}
if ( ! this.counter.restart) {
- ;;; kukit.logDebug('Yes, iframe is loaded.');
- // XXX attribute access starting with _ breaks full compression, even in strings
+;;; kukit.logDebug('Yes, iframe is loaded.');
+ // XXX attribute access starting with _ breaks full compression,
+ // even in strings
// doc._embeddedContentLoadedInitDone = true;
doc['_' + 'embeddedContentLoadedInitDone'] = true;
this.func();
Modified: kukit/kukit.js/trunk/kukit/errors.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/errors.js (original)
+++ kukit/kukit.js/trunk/kukit/errors.js Thu Aug 16 22:32:22 2007
@@ -1,9 +1,6 @@
/*
-* Copyright (c) 2005-2006
-* Authors:
-* Godefroid Chapelle <gotcha at bubblenet.be>
-* Florian Schulze <florian.schulze at gmx.net>
-* Balázs Reé <ree at greenfinity.hu>
+* Copyright (c) 2005-2007
+* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -76,49 +73,58 @@
;;; // this should be thrown with the error command as parameter
;;; kukit.err.ExplicitError = kukit.err.exceptionFactory('ExplicitError');
-;;; kukit.err.ExplicitError.prototype.__superinit__ = kukit.err.ExplicitError.prototype.__init__;
-;;; kukit.err.ExplicitError.prototype.__init__ = function(name, errorcommand) {
+;;; kukit.err.ee = kukit.err.ExplicitError;
+;;; kukit.err.ee.prototype.__superinit__ = kukit.err.ee.prototype.__init__;
+;;; kukit.err.ee.prototype.__init__ = function(name, errorcommand) {
;;; var message = 'Explicit error';
;;; var kw = this.__superinit__(name, message);
;;; kw.errorcommand = errorcommand;
;;; return kw;
;;; };
-;;; kukit.err.ResponseParsingError = kukit.err.exceptionFactory('ResponseParsingError');
+;;; var name = 'ResponseParsingError';
+;;; kukit.err.ResponseParsingError = kukit.err.exceptionFactory(name);
-;;; kukit.err.CommandExecutionError = kukit.err.exceptionFactory('CommandExecutionError');
-;;; kukit.err.CommandExecutionError.prototype.__superinit__ = kukit.err.CommandExecutionError.prototype.__init__;
-;;; kukit.err.CommandExecutionError.prototype.__init__ = function(name, e, command) {
+;;; var name = 'CommandExecutionError';
+;;; kukit.err.CommandExecutionError = kukit.err.exceptionFactory(name);
+;;; kukit.err.cex = kukit.err.CommandExecutionError;
+;;; kukit.err.cex.prototype.__superinit__ = kukit.err.cex.prototype.__init__;
+;;; kukit.err.cex.prototype.__init__ = function(name, e, command) {
;;; var kw = this.__superinit__(name, '');
-;;; kw.message = 'Command "' + command.name + '": ' + e.toString();
+;;; kw.message = 'Command [' + command.name + '] ' + e.toString();
;;; return kw;
;;; };
kukit.err.rd = {};
;;; kukit.err.rd.RuleMergeError = kukit.err.exceptionFactory('RuleMergeError');
-;;; kukit.err.rd.KssSelectorError = kukit.err.exceptionFactory('KssSelectorError');
+;;; var name = 'KssSelectorError';
+;;; kukit.err.rd.KssSelectorError = kukit.err.exceptionFactory(name);
-;;; kukit.err.rd.EventBindError = kukit.err.exceptionFactory('EventBindError');
-;;; kukit.err.rd.EventBindError.prototype.__superinit__ = kukit.err.rd.EventBindError.prototype.__init__;
-;;; kukit.err.rd.EventBindError.prototype.__init__ = function(name, message, eventname, eventnamespace) {
+;;; var name = 'EventBindError';
+;;; kukit.err.rd.EventBindError = kukit.err.exceptionFactory(name);
+;;; kukit.err.rd.ebe = kukit.err.rd.EventBindError;
+;;; kukit.err.rd.ebe.prototype.__superinit__ = kukit.err.rd.ebe.prototype.__init__;
+;;; kukit.err.rd.ebe.prototype.__init__ = function(name, message, eventName, eventNamespace) {
;;; var kw = this.__superinit__(name, message);
-;;; kw.eventname = eventname;
-;;; kw.eventnamespace = eventnamespace;
-;;; kw.message = kw.message + ' when binding event name "' + eventname + '" on namespace "' + eventnamespace + '"';
+;;; kw.eventName = eventName;
+;;; kw.eventNamespace = eventNamespace;
+;;; kw.message += ' When binding event name [' + eventName;
+;;; kw.message += '] in namespace [' + eventNamespace + '].';
;;; return kw;
;;; };
kukit.err.tk = {};
;;; kukit.err.tk.ParsingError = kukit.err.exceptionFactory('ParsingError');
-;;; kukit.err.tk.ParsingError.prototype.__superinit__ = kukit.err.tk.ParsingError.prototype.__init__;
-;;; kukit.err.tk.ParsingError.prototype.__init__ = function(name, message, cursor) {
+;;; kukit.err.tk.pe = kukit.err.tk.ParsingError;
+;;; kukit.err.tk.pe.prototype.__superinit__ = kukit.err.tk.pe.prototype.__init__;
+;;; kukit.err.tk.pe.prototype.__init__ = function(name, message, cursor) {
;;; var kw = this.__superinit__(name, message);
;;; if (cursor) {
;;; kw.errpos = cursor.pos;
;;; kw.errrow = cursor.row;
;;; kw.errcol = cursor.col;
-;;; kw.message = kw.message + ' at row ' + kw.errrow + ', column ' + kw.errcol;
+;;; kw.message += ' at row ' + kw.errrow + ', column ' + kw.errcol;
;;; } else {
;;; kw.errpos = null;
;;; kw.errrow = null;
Modified: kukit/kukit.js/trunk/kukit/eventreg.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/eventreg.js (original)
+++ kukit/kukit.js/trunk/kukit/eventreg.js Thu Aug 16 22:32:22 2007
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2005-2007
-* Authors: KSS Project Contributors (see docs/CREDITS.txt)
+* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -30,48 +30,50 @@
*
* usage:
*
-* kukit.eventsGlobalRegistry.register(namespace, eventname, func,
-* bindmethodname, defaultactionmethodname);
+* kukit.eventsGlobalRegistry.register(namespace, eventName, func,
+* bindMethodName, defaultActionMethodName);
*
* namespace = null: means global namespace
-* defaultactionmethodname = null: if there is no default action implemented
+* defaultActionMethodName = null: if there is no default action implemented
* func must be a class (constructor) function, this is the class that
* implements the binder.
*/
kukit.er.EventRegistry = function () {
this.content = {};
this.classes = {};
- this.eventsets = [];
+ this.eventSets = [];
};
/* binder registration */
-kukit.er.EventRegistry.prototype.registerBinder = function(classname, func) {
+kukit.er.EventRegistry.prototype.registerBinder = function(className, func) {
if (typeof(func) == 'undefined') {
- ;;; kukit.E = 'func argument is mandatory when registering an event binder (EventRegistry.registerBinder).';
+;;; kukit.E = 'func argument is mandatory when registering an event';
+;;; kukit.E += ' binder (EventRegistry.registerBinder).';
throw kukit.E;
}
- if (this.classes[classname]) {
+ if (this.classes[className]) {
// Do not allow redefinition
- ;;; kukit.logError('Error : event class "' + classname + '" already registered.');
+;;; var msg = 'Error : event class [' + className + '] already registered.';
+;;; kukit.logError(msg);
return;
}
// Decorate and store the class
kukit.er.decorateEventBinderClass(func);
- this.classes[classname] = func;
+ this.classes[className] = func;
};
-kukit.er.EventRegistry.prototype.existsBinder = function(classname) {
- var func = this.classes[classname];
+kukit.er.EventRegistry.prototype.existsBinder = function(className) {
+ var func = this.classes[className];
return (typeof(func) != 'undefined');
};
-kukit.er.EventRegistry.prototype.getBinder = function(classname) {
- var func = this.classes[classname];
+kukit.er.EventRegistry.prototype.getBinder = function(className) {
+ var func = this.classes[className];
if (! func) {
// not found
- ;;; kukit.E = 'Error : undefined event setup type ' + classname;
+;;; kukit.E = 'Error : undefined event setup type [' + className + '].';
throw kukit.E;
}
return func;
@@ -79,121 +81,134 @@
/* events (methods) registration helpers (not to be called directly) */
-kukit.er.EventRegistry.prototype._register = function(namespace, eventname, klass,
- bindmethodname, defaultactionmethodname, itername) {
- if (typeof(defaultactionmethodname) == 'undefined') {
- ;;; kukit.E = 'some arguments are not passed when calling EventRegistry.register';
+kukit.er.EventRegistry.prototype._register =
+ function(namespace, eventName, klass,
+ bindMethodName, defaultActionMethodName, iterName) {
+ if (typeof(defaultActionMethodName) == 'undefined') {
+;;; kukit.E = 'Missing arguments when calling [EventRegistry.register].';
throw kukit.E;
}
// Find out the class name. (Not specified now.)
- var classname = klass.prototype.__classname__;
- if (typeof(classname) == 'undefined') {
- // Create a classname, and register it too.
- classname = '' + kukit.er.eventClassCounter;
+ var className = klass.prototype.__className__;
+ if (typeof(className) == 'undefined') {
+ // Create a className, and register it too.
+ className = '' + kukit.er.eventClassCounter;
kukit.er.eventClassCounter += 1;
- this.registerBinder(classname, klass);
- klass.prototype.__classname__ = classname;
+ this.registerBinder(className, klass);
+ klass.prototype.__className__ = className;
}
- if (!eventname) {
- ;;; kukit.E = 'eventname argument cannot be empty when registering an event (EventRegistry.register)';
+ if (!eventName) {
+;;; kukit.E = '[eventName] argument cannot be empty when registering';
+;;; kukit.E += ' an event with [EventRegistry.register].';
throw kukit.E;
}
- var key = this._getKey(namespace, eventname);
+ var key = this._getKey(namespace, eventName);
var entry = this.content[key];
if (typeof(entry) != 'undefined') {
if (key[0] == '-') {
key = key.substring(1);
}
- ;;; kukit.E = 'In EventRegistry.register double registration of key "' + key + '"';
- throw kukit.E;
- }
- // check bindmethodname and defaultactionmethodname
- if (bindmethodname && ! klass.prototype[bindmethodname]) {
- ;;; kukit.E = 'In EventRegistry.register bind method "' + bindmethodname;
- ;;; kukit.E += '" is undefined for event "' + eventname + '" namespace "' + namespace + '"';
- throw kukit.E;
- }
- if (defaultactionmethodname && ! klass.prototype[defaultactionmethodname]) {
- ;;; kukit.E = 'In EventRegistry.register default action method "' + defaultactionmethodname;
- ;;; kukit.E += '" is undefined for event "' + eventname + '" namespace "' + namespace + '"';
+;;; kukit.E = 'Attempt to register key [' + key;
+;;; kukit.E += '] twice when registering';
+;;; kukit.E += ' an event with [EventRegistry.register].';
+ throw kukit.E;
+ }
+ // check bindMethodName and defaultActionMethodName
+ if (bindMethodName && ! klass.prototype[bindMethodName]) {
+;;; kukit.E = 'In EventRegistry.register bind method [' + bindMethodName;
+;;; kukit.E += '] is undefined for event [' + eventName;
+;;; kukit.E += '] namespace [' + namespace + '].';
+ throw kukit.E;
+ }
+ if (defaultActionMethodName && ! klass.prototype[defaultActionMethodName]) {
+;;; kukit.E = 'In EventRegistry.register default action method [';
+;;; kukit.E += defaultActionMethodName + '] is undefined for event [';
+;;; kukit.E += eventName + '] namespace [' + namespace + '].';
throw kukit.E;
}
// check the iterator.
- if (! kukit.er.getBindIterator(itername)) {
- ;;; kukit.E = 'In EventRegistry.register unknown bind iterator "' + itername + '"';
+ if (! kukit.er.getBindIterator(iterName)) {
+;;; kukit.E = 'In EventRegistry.register unknown bind iterator [';
+;;; kukit.E += iterName + '].';
throw kukit.E;
}
// register it
this.content[key] = {
- 'classname': classname,
- 'bindmethodname': bindmethodname,
- 'defaultactionmethodname': defaultactionmethodname,
- 'itername': itername
+ 'className': className,
+ 'bindMethodName': bindMethodName,
+ 'defaultActionMethodName': defaultActionMethodName,
+ 'iterName': iterName
};
};
-/* events (methods) binding "ForAll" registration */
+/* events (methods) binding [ForAll] registration */
-kukit.er.EventRegistry.prototype._registerEventSet = function(namespace, names, itername, bindmethodname) {
+kukit.er.EventRegistry.prototype._registerEventSet =
+ function(namespace, names, iterName, bindMethodName) {
// At this name the values should be checked already. so this should
// be called _after_ _register.
- this.eventsets.push({
+ this.eventSets.push({
'namespace': namespace,
'names': names,
- 'itername': itername,
- 'bindmethodname': bindmethodname
+ 'iterName': iterName,
+ 'bindMethodName': bindMethodName
});
};
/* there are the actual registration methods, to be called from plugins */
-kukit.er.EventRegistry.prototype.register = function(namespace, eventname, klass,
- bindmethodname, defaultactionmethodname) {
- this._register(namespace, eventname, klass, bindmethodname, defaultactionmethodname, 'each_legacy');
- this._registerEventSet(namespace, [eventname], 'each_legacy', bindmethodname);
-};
-
-kukit.er.EventRegistry.prototype.registerForAllEvents = function(namespace, eventnames, klass,
- bindmethodname, defaultactionmethodname, itername) {
- if (typeof(eventnames) == 'string') {
- eventnames = [eventnames];
- }
- for (var i=0; i<eventnames.length; i++) {
- var eventname = eventnames[i];
- this._register(namespace, eventname, klass, bindmethodname, defaultactionmethodname, itername);
+kukit.er.EventRegistry.prototype.register =
+ function(namespace, eventName, klass, bindMethodName,
+ defaultActionMethodName) {
+ this._register(namespace, eventName, klass, bindMethodName,
+ defaultActionMethodName, 'EachLegacy');
+ this._registerEventSet(namespace, [eventName], 'EachLegacy',
+ bindMethodName);
+};
+
+kukit.er.EventRegistry.prototype.registerForAllEvents =
+ function(namespace, eventNames, klass,
+ bindMethodName, defaultActionMethodName, iterName) {
+ if (typeof(eventNames) == 'string') {
+ eventNames = [eventNames];
+ }
+ for (var i=0; i<eventNames.length; i++) {
+ var eventName = eventNames[i];
+ this._register(namespace, eventName, klass, bindMethodName,
+ defaultActionMethodName, iterName);
}
- this._registerEventSet(namespace, eventnames, itername, bindmethodname);
+ this._registerEventSet(namespace, eventNames, iterName, bindMethodName);
};
-kukit.er.EventRegistry.prototype._getKey = function(namespace, eventname) {
+kukit.er.EventRegistry.prototype._getKey = function(namespace, eventName) {
if (namespace == null) {
namespace = '';
} else if (namespace.split('-') > 1) {
- ;;; kukit.E = 'In EventRegistry.register namespace cannot contain -';
+;;; kukit.E = 'In [EventRegistry.register], [namespace] cannot have';
+;;; kukit.E += 'dashes.';
throw kukit.E;
}
- return namespace + '-' + eventname;
+ return namespace + '-' + eventName;
};
-kukit.er.EventRegistry.prototype.exists = function(namespace, eventname) {
- var key = this._getKey(namespace, eventname);
+kukit.er.EventRegistry.prototype.exists = function(namespace, eventName) {
+ var key = this._getKey(namespace, eventName);
var entry = this.content[key];
return (typeof(entry) != 'undefined');
};
-kukit.er.EventRegistry.prototype.get = function(namespace, eventname) {
- var key = this._getKey(namespace, eventname);
+kukit.er.EventRegistry.prototype.get = function(namespace, eventName) {
+ var key = this._getKey(namespace, eventName);
var entry = this.content[key];
if (typeof(entry) == 'undefined') {
- if (key.substr(0, 1) == '-') {
- ;;; key = key.substring(1);
- ;;; kukit.E = 'Error : undefined global event key ';
- ;;; kukit.E += key + ' (or maybe namespace is missing?)';
- throw kukit.E;
- } else {
- ;;; kukit.E = 'Error : undefined event key ' + key;
- throw kukit.E;
- }
+;;; if (key.substr(0, 1) == '-') {
+;;; key = key.substring(1);
+;;; kukit.E = 'Error : undefined global event key ';
+;;; kukit.E += key + ' (or maybe namespace is missing ?).';
+;;; } else {
+;;; kukit.E = 'Error : undefined event key [' + key + '].';
+;;; }
+ throw kukit.E;
}
return entry;
};
@@ -204,11 +219,14 @@
/* XXX deprecated methods, to be removed asap */
kukit.er.eventRegistry = {};
-kukit.er.eventRegistry.register = function(namespace, eventname, klass,
- bindmethodname, defaultactionmethodname) {
- kukit.logWarning('Deprecated kukit.er.eventRegistry.register, use kukit.eventsGlobalRegistry.register instead! (' + namespace + '-' + eventname + ')');
- kukit.eventsGlobalRegistry.register(namespace, eventname, klass,
- bindmethodname, defaultactionmethodname);
+kukit.er.eventRegistry.register = function(namespace, eventName, klass,
+ bindMethodName, defaultActionMethodName) {
+;;; var msg = 'Deprecated kukit.er.eventRegistry.register,';
+;;; msg += ' use kukit.eventsGlobalRegistry.register instead ! [';
+;;; msg += namespace + '-' + eventName + '].';
+;;; kukit.logWarning(msg);
+ kukit.eventsGlobalRegistry.register(namespace, eventName, klass,
+ bindMethodName, defaultActionMethodName);
};
/* Event class decoration
@@ -223,13 +241,13 @@
* continuation event.
* Parameters will be the ones specified in the call +
* those defined in the rule will be added too. (Parameters can
-* be accessed with the "pass" kss parameter provider.)
+* be accessed with the [pass] kss parameter provider.)
*
* Call examples:
*
* trigger an event bound to a given state instance, same node
*
-* binderinstance.__continue_event__('doit', oper.node, {'extravalue': '5'});
+* binderInstance.__continueEvent__('doit', oper.node, {'extravalue': '5'});
*
* with kss rule:
*
@@ -248,7 +266,7 @@
* trigger an event bound to a given state instance, and the document
* (different from current scope)
*
-* binderinstance.__continue_event__('doit', null, {'extravalue': '5'});
+* binderInstance.__continueEvent__('doit', null, {'extravalue': '5'});
*
* with kss rule:
*
@@ -266,7 +284,7 @@
*
* trigger an event on all the nodes + document bound to a given state instance
*
-* binderinstance.__continue_event_allnodes__('doit', {'extravalue': '5'});
+* binderInstance.__continueEvent_allNodes__('doit', {'extravalue': '5'});
*
* with kss rule:
*
@@ -279,7 +297,8 @@
* so we create a new oper below
*/
-kukit.er.EventBinder__continue_event__ = function(name, node, defaultparms) {
+kukit.er.EventBinder__continueEvent__ =
+ function(name, node, defaultParameters) {
// Trigger a continuation event bound to a given state instance, given node
// (or on document, if node = null)
//
@@ -287,40 +306,48 @@
oper.node = node;
if (node) {
// if we found the binding, just use that
- var info = kukit.engine.binderInfoRegistry.getBinderInfoById(this.__binder_id__);
- var newoper = info.bound.getBoundOperForNode(name, node);
- if (newoper) {
- oper = newoper;
+ var info = kukit.engine.binderInfoRegistry.getBinderInfoById(
+ this.__binderId__);
+ var newOper = info.bound.getBoundOperForNode(name, node);
+ if (newOper) {
+ oper = newOper;
}
} else {
- oper.eventrule = kukit.engine.documentRules.getMergedRule('document', name, this);
+ oper.eventRule = kukit.engine.documentRules.getMergedRule(
+ 'document', name, this);
}
// Look up the behaviour rule, if any.
- var behav_eventrule = kukit.engine.documentRules.getMergedRule('behaviour', name, this);
- if (behav_eventrule) {
- if (! oper.eventrule) {
+ var behav_eventRule = kukit.engine.documentRules.getMergedRule(
+ 'behaviour', name, this);
+ if (behav_eventRule) {
+ if (! oper.eventRule) {
// There was no node matching for the rule, use behaviour rule
// this allows to set up parametrized actions in general.
- oper.eventrule = behav_eventrule;
+ oper.eventRule = behav_eventRule;
} else {
- // XXX this case should go away, as we should check this already from binding time
+ // XXX this case should go away, as we should check
+ // this already from binding time
// and signal the appropriate error.
- // Also note that behaviour roles will only be allowed for "non-binding" events.
- ;;; kukit.logError('Behaviour rule for continuation event "' + name + '" will be ignored, because we found an explicit rule.');
+ // Also note that behaviour roles will only be allowed
+ // for "non-binding" events.
+;;; var msg = 'Behaviour rule for continuation event [' + name;
+;;; msg += '] will be ignored, because we found an explicit rule.';
+;;; kukit.logError(msg);
}
}
- // If parameters are specified in the call, use them.
- if (typeof(defaultparms) != 'undefined') {
- oper.defaultparms = defaultparms;
+ // If parms are specified in the call, use them.
+ if (typeof(defaultParameters) != 'undefined') {
+ oper.defaultParameters = defaultParameters;
} else {
- oper.defaultparms = {};
+ oper.defaultParameters = {};
}
- // (if eventrule is null here, we can yet have the default method, so go on.)
- this._EventBinder_triggerevent(name, oper);
- ;;; kukit.logDebug('Continuation event "' + name + '" executed on same node.');
+ // if eventRule is null here, we can yet have the default method, so go on.
+ this._EventBinder_triggerEvent(name, oper);
+;;; kukit.logDebug('Continuation event [' + name + '] executed on same node.');
};
-kukit.er.EventBinder__continue_event_allnodes__ = function(name, defaultparms) {
+kukit.er.EventBinder__continueEvent_allNodes__ =
+ function(name, defaultParameters) {
// Trigger an event bound to a given state instance, on all nodes.
// (or on document, if node = null)
// if no other nodes execute.
@@ -328,20 +355,21 @@
// Normal rules. If any of those match, execute them too
// each on the node that it selects - not on the original node.
var oper = new kukit.op.Oper();
- var info = kukit.engine.binderInfoRegistry.getBinderInfoById(this.__binder_id__);
+ var info = kukit.engine.binderInfoRegistry.getBinderInfoById(
+ this.__binderId__);
var opers = info.bound.getBoundOpers(name);
for (var i=0; i<opers.length; i++) {
var oper = opers[i];
- var newoper = oper.clone();
- if (typeof(defaultparms) != 'undefined') {
- newoper.defaultparms = defaultparms;
+ var newOper = oper.clone();
+ if (typeof(defaultParameters) != 'undefined') {
+ newOper.defaultParameters = defaultParameters;
} else {
- newoper.defaultparms = {};
+ newOper.defaultParameters = {};
}
- this._EventBinder_triggerevent(name, newoper);
+ this._EventBinder_triggerEvent(name, newOper);
executed += 1;
}
- ;;; kukit.logDebug('Event "' + name + '" executed on ' + executed + ' nodes.');
+;;; kukit.logDebug('Event [' + name + '] executed on ' + executed + ' nodes.');
};
kukit.er.EventBinder_makeFuncToBind = function(name, node) {
@@ -351,8 +379,8 @@
};
};
-kukit.er.LateBinder = function(binderinstance, name, node) {
- this.binderinstance = binderinstance;
+kukit.er.LateBinder = function(binderInstance, name, node) {
+ this.binderInstance = binderInstance;
this.name = name;
this.node = node;
this.bound = null;
@@ -360,45 +388,52 @@
kukit.er.LateBinder.prototype.executeActions = function() {
if (! this.bound) {
- ;;; kukit.log('Attempt of late binding for event ' + this.name + ', node ' + this.node.nodeName);
+;;; var msg = 'Attempt of late binding for event [' + this.name;
+;;; msg += '], node [' + this.node.nodeName + '].';
+;;; kukit.log(msg);
if (kukit.hasFirebug) {
kukit.log(this.node);
}
- var info = kukit.engine.binderInfoRegistry.getBinderInfoById(this.binderinstance.__binder_id__);
+ var info = kukit.engine.binderInfoRegistry.getBinderInfoById(
+ this.binderInstance.__binderId__);
var oper = info.bound.getBoundOperForNode(this.name, this.node);
if (oper) {
- // (if eventrule is null here, we can yet have the default method, so go on.)
+ // (if eventRule is null here, we could still have the default
+ // method, so go on.)
oper.parms = {};
this.bound = function() {
- this.binderinstance._EventBinder_triggerevent(this.name, oper);
+ this.binderInstance._EventBinder_triggerEvent(this.name, oper);
};
- ;;; kukit.log('node bound');
+;;; kukit.log('Node bound.');
} else {
- ;;; kukit.logWarning('no node bound');
+;;; kukit.logWarning('No node bound.');
this.bound = function() {};
}
}
this.bound();
};
-kukit.er.EventBinder_triggerevent = function(name, oper) {
- // Private. Called from __continue_event__ or from main event execution.
- oper.binderinstance = this;
- if (oper.eventrule) {
+kukit.er.EventBinder_triggerEvent = function(name, oper) {
+ // Private. Called from __continueEvent__ or from main event execution.
+ oper.binderInstance = this;
+ if (oper.eventRule) {
// Call the actions, if we had an event rule.
// This includes calling the default action.
- oper.eventrule.actions.execute(oper);
+ oper.eventRule.actions.execute(oper);
} else {
// In case there is no event rule, just call the default event action.
- var namespace = this.__event_namespace__;
- ;;; kukit.logDebug('Calling implicit event "' + name + '" on namespace "' + namespace + '"');
+ var namespace = this.__eventNamespace__;
+;;; var msg = 'Calling implicit event [' + name + '] on namespace [';
+;;; msg += namespace + '].';
+;;; kukit.logDebug(msg);
var success = oper.executeDefaultAction(name, true);
if (! success) {
// instead of the standard message give more specific reason:
// either way we should have executed something...
- ;;; kukit.E = 'Could not trigger event name "' + name;
- ;;; kukit.E += '" on namespace "' + namespace;
- ;;; kukit.E += '", because there is neither an explicit kss rule, nor a default method';
+;;; kukit.E = 'Could not trigger event name [' + name;
+;;; kukit.E += '] on namespace [' + namespace;
+;;; kukit.E += '], because there is neither an explicit KSS rule,';
+;;; kukit.E += ' nor a default method';
throw kukit.E;
}
}
@@ -406,27 +441,28 @@
/* (default) method call handling */
-kukit.er.EventBinder_callmethod = function(namespace, name, oper, methodname) {
+kukit.er.EventBinder_callMethod = function(namespace, name, oper, methodName) {
// hidden method for calling just a method and checking that is exists.
// (called from oper)
- var method = this[methodname];
+ var method = this[methodName];
if (! method) {
- ;;; kukit.E = 'Could not trigger event name "' + name;
- ;;; kukit.E += '" on namespace "' + namespace;
- ;;; kukit.E += '", because the method "' + methodname + '" does not exist.';
+;;; kukit.E = 'Could not trigger event name [' + name;
+;;; kukit.E += '] on namespace [' + namespace;
+;;; kukit.E += '], because the method [' + methodName + '] does not exist.';
throw kukit.E;
}
// call it
- oper.binderinstance = this;
+ oper.binderInstance = this;
method.call(this, name, oper);
};
kukit.er.decorateEventBinderClass = function(cls) {
- cls.prototype.__continue_event__ = kukit.er.EventBinder__continue_event__;
- cls.prototype.__continue_event_allnodes__ = kukit.er.EventBinder__continue_event_allnodes__;
- cls.prototype._EventBinder_triggerevent = kukit.er.EventBinder_triggerevent;
- cls.prototype._EventBinder_callmethod = kukit.er.EventBinder_callmethod;
- cls.prototype.__make_func_to_bind__ = kukit.er.EventBinder_makeFuncToBind;
+ cls.prototype.__continueEvent__ = kukit.er.EventBinder__continueEvent__;
+ cls.prototype.__continueEvent_allNodes__ =
+ kukit.er.EventBinder__continueEvent_allNodes__;
+ cls.prototype._EventBinder_triggerEvent = kukit.er.EventBinder_triggerEvent;
+ cls.prototype._EventBinder_callMethod = kukit.er.EventBinder_callMethod;
+ cls.prototype.__makeFuncToBind__ = kukit.er.EventBinder_makeFuncToBind;
};
/* Event instance registry
@@ -441,62 +477,69 @@
this.info = {};
};
-kukit.er.BinderInfoRegistry.prototype.getOrCreateBinderInfo = function (id, classname, namespace) {
+kukit.er.BinderInfoRegistry.prototype.getOrCreateBinderInfo =
+ function (id, className, namespace) {
// Get or create the event.
- var binderinfo = this.info[id];
- if (typeof(binderinfo) == 'undefined') {
+ var binderInfo = this.info[id];
+ if (typeof(binderInfo) == 'undefined') {
// Create a new event.
- ;;; kukit.logDebug('instantiating event id=' + id + ', classname=' + classname + ', namespace=' + namespace);
- binderinstance = new (kukit.eventsGlobalRegistry.getBinder(classname))();
+;;; var msg = 'Instantiating event id [' + id + '], className [';
+;;; msg += className + '], namespace [' + namespace + '].';
+;;; kukit.logDebug(msg);
+ var binder = kukit.eventsGlobalRegistry.getBinder(className);
+ var binderInstance = new binder();
- binderinfo = this.info[id] = new kukit.er.BinderInfo(binderinstance);
+ binderInfo = this.info[id] = new kukit.er.BinderInfo(binderInstance);
// decorate it with id and class
- binderinstance.__binder_id__ = id;
- binderinstance.__binder_classname__ = classname;
- binderinstance.__event_namespace__ = namespace;
+ binderInstance.__binderId__ = id;
+ binderInstance.__binderClassName__ = className;
+ binderInstance.__eventNamespace__ = namespace;
// store the bound rules
- //binderinstance.__bound_rules__ = [];
- } else if (binderinfo.getBinderInstance().__binder_classname__ != classname) {
+ //binderInstance.__bound_rules__ = [];
+ } else if (binderInfo.getBinderInstance().__binderClassName__ !=
+ className) {
// just paranoia
- ;;; kukit.E = 'Conflicting class for event id "' + id + '", "';
- ;;; kukit.E += binderinfo.getBinderInstance().__binder_classname__ + '" != "' + classname + '"';
+;;; kukit.E = 'Conflicting class for event id [' + id + '], [';
+;;; kukit.E += binderInfo.getBinderInstance().__binderClassName__;
+;;; kukit.E += '] != [' + className + '].';
throw kukit.E;
}
- return binderinfo;
+ return binderInfo;
};
kukit.er.BinderInfoRegistry.prototype.getBinderInfoById = function (id) {
// Get an event.
- var binderinfo = this.info[id];
- if (typeof(binderinfo) == 'undefined') {
- ;;; kukit.E = 'Event with id "' + id + '" not found.';
+ var binderInfo = this.info[id];
+ if (typeof(binderInfo) == 'undefined') {
+;;; kukit.E = 'Event with id [' + id + '] not found.';
throw kukit.E;
}
- return binderinfo;
+ return binderInfo;
};
-kukit.er.BinderInfoRegistry.prototype.getSingletonBinderInfoByName = function (namespace, name) {
- //Get classname
- var classname = kukit.eventsGlobalRegistry.get(namespace, name).classname;
+kukit.er.BinderInfoRegistry.prototype.getSingletonBinderInfoByName =
+ function (namespace, name) {
+ //Get className
+ var className = kukit.eventsGlobalRegistry.get(namespace, name).className;
// Get an event.
- var id = kukit.rd.makeId(namespace, classname);
- var binderinfo = this.info[id];
- if (typeof(binderinfo) == 'undefined') {
- ;;; kukit.E = 'Singleton event with namespace "' + namespace;
- ;;; kukit.E += '" and (event) name "' + name + '" not found.';
+ var id = kukit.rd.makeId(namespace, className);
+ var binderInfo = this.info[id];
+ if (typeof(binderInfo) == 'undefined') {
+;;; kukit.E = 'Singleton event with namespace [' + namespace;
+;;; kukit.E += '] and (event) name [' + name + '] not found.';
throw kukit.E;
}
- return binderinfo;
+ return binderInfo;
};
kukit.er.BinderInfoRegistry.prototype.startBindingPhase = function () {
// At the end of the binding phase, we want to process our events. This
// must include all the binder instances we bound in this phase.
for (var id in this.info) {
- var binderinfo = this.info[id];
+ var binderInfo = this.info[id];
// process binding on this instance.
- binderinfo.startBindingPhase();
+ binderInfo.startBindingPhase();
}
};
@@ -504,9 +547,9 @@
// At the end of the binding phase, we want to process our events. This
// must include all the binder instances we bound in this phase.
for (var id in this.info) {
- var binderinfo = this.info[id];
+ var binderInfo = this.info[id];
// process binding on this instance.
- binderinfo.processBindingEvents();
+ binderInfo.processBindingEvents();
}
};
@@ -518,14 +561,14 @@
*
*/
-kukit.er.BinderInfo = function (binderinstance) {
- this.binderinstance = binderinstance;
+kukit.er.BinderInfo = function (binderInstance) {
+ this.binderInstance = binderInstance;
this.bound = new kukit.er.OperRegistry();
this.startBindingPhase();
};
kukit.er.BinderInfo.prototype.getBinderInstance = function () {
- return this.binderinstance;
+ return this.binderInstance;
};
kukit.er.BinderInfo.prototype.startBindingPhase = function () {
@@ -535,8 +578,8 @@
};
kukit.er.BinderInfo.prototype.bindOper = function (oper) {
- // We mark a given oper. This means a binding on the binderinstance
- // for given event, node and eventrule (containing event namespace,
+ // We mark a given oper. This means a binding on the binderInstance
+ // for given event, node and eventRule (containing event namespace,
// name, and evt- parms.)
//
// first see if it can go to already bound ones
@@ -548,7 +591,7 @@
kukit.er.BinderInfo.prototype.processBindingEvents = function () {
// We came to the end of the binding phase. Now we process all our binding
// events, This will do the actual binding on the browser side.
- this.binding.processBindingEvents(this.binderinstance);
+ this.binding.processBindingEvents(this.binderInstance);
// Now we to add these to the new ones.
this.binding.propagateTo(this.bound);
// Delete them from the registry, to protect against accidents.
@@ -567,88 +610,96 @@
*/
kukit.er.OperRegistry = function () {
- this.infopername = {};
- this.infopernode = {};
+ this.infoPerName = {};
+ this.infoPerNode = {};
};
// XXX XXX XXX we can do this without full cloning, more efficiently.
kukit.er.OperRegistry.prototype.propagateTo = function (newreg) {
- for (var key in this.infopername) {
- var rules_per_name = this.infopername[key];
- for (var name in rules_per_name) {
- var oper = rules_per_name[name];
+ for (var key in this.infoPerName) {
+ var rulesPerName = this.infoPerName[key];
+ for (var name in rulesPerName) {
+ var oper = rulesPerName[name];
newreg.bindOper(oper);
}
}
};
-kukit.er.OperRegistry.prototype.checkOperBindable = function (oper, name, nodehash) {
+kukit.er.OperRegistry.prototype.checkOperBindable =
+ function (oper, name, nodeHash) {
// Check if the binding with this oper could be done.
// Throw exception otherwise.
//
- // Remark. We need different check and bind method, because we need to bind to the currently
- // processed nodes, but we need to check duplication in all the previously bound nodes.
- var info = this.infopername;
- // name and nodehash are for speedup.
- if (typeof(nodehash) == 'undefined') {
- name = oper.eventrule.kss_selector.name;
- nodehash = kukit.rd.hashnode(oper.node);
+ // Remark. We need different check and bind method,
+ // because we need to bind to the currently
+ // processed nodes, but we need to check duplication
+ // in all the previously bound nodes.
+ var info = this.infoPerName;
+ // name and nodeHash are for speedup.
+ if (typeof(nodeHash) == 'undefined') {
+ name = oper.eventRule.kssSelector.name;
+ nodeHash = kukit.rd.hashNode(oper.node);
}
- var rules_per_name = info[name];
- if (typeof(rules_per_name) == 'undefined') {
+ var rulesPerName = info[name];
+ if (typeof(rulesPerName) == 'undefined') {
// Create an empty list.
- rules_per_name = info[name] = {};
- } else if (typeof(rules_per_name[nodehash]) != 'undefined') {
- ;;; kukit.E = 'Mismatch in bind registry, ' + name + ' already bound to node in this instance.';
+ rulesPerName = info[name] = {};
+ } else if (typeof(rulesPerName[nodeHash]) != 'undefined') {
+;;; kukit.E = 'Mismatch in bind registry,[ ' + name;
+;;; kukit.E += '] already bound to node in this instance.';
throw kukit.E;
}
- return rules_per_name;
+ return rulesPerName;
};
kukit.er.OperRegistry.prototype.bindOper = function (oper) {
- // Marks binding between binderinstance, eventname, node.
- var name = oper.eventrule.kss_selector.name;
- var nodehash = kukit.rd.hashnode(oper.node);
- var rules_per_name = this.checkOperBindable(oper, name, nodehash);
- rules_per_name[nodehash] = oper;
+ // Marks binding between binderInstance, eventName, node.
+ var name = oper.eventRule.kssSelector.name;
+ var nodeHash = kukit.rd.hashNode(oper.node);
+ var rulesPerName = this.checkOperBindable(oper, name, nodeHash);
+ rulesPerName[nodeHash] = oper;
// also store per node info
- var rules_per_node = this.infopernode[nodehash];
- if (typeof(rules_per_node) == 'undefined') {
+ var rulesPerNode = this.infoPerNode[nodeHash];
+ if (typeof(rulesPerNode) == 'undefined') {
// Create an empty list.
- rules_per_node = this.infopernode[nodehash] = {};
+ rulesPerNode = this.infoPerNode[nodeHash] = {};
}
- rules_per_node[name] = oper;
+ rulesPerNode[name] = oper;
};
// XXX This will need refactoring.
/// We would only want to lookup from our registry and not the other way around.
-kukit.er.OperRegistry.prototype.processBindingEvents = function (binderinstance) {
+kukit.er.OperRegistry.prototype.processBindingEvents =
+ function (binderInstance) {
var eventRegistry = kukit.eventsGlobalRegistry;
- for (var i=0; i < eventRegistry.eventsets.length; i++) {
- var eventset = eventRegistry.eventsets[i];
+ for (var i=0; i < eventRegistry.eventSets.length; i++) {
+ var eventSet = eventRegistry.eventSets[i];
// Only process binding events (and ignore non-binding ones)
- if (eventset.bindmethodname) {
- if (binderinstance.__event_namespace__ == eventset.namespace) {
- // Process the binding event set. This will call the actual bindmethods
+ if (eventSet.bindMethodName) {
+ if (binderInstance.__eventNamespace__ == eventSet.namespace) {
+ // Process the binding event set.
+ // This will call the actual bindmethods
// according to the specified iterator.
- var iterator = kukit.er.getBindIterator(eventset.itername);
- iterator.call(this, eventset, binderinstance);
+ var iterator = kukit.er.getBindIterator(eventSet.iterName);
+ iterator.call(this, eventSet, binderInstance);
}
}
}
};
-// XXX The following methods will probably disappear as iterators replace their functionality.
+// XXX The following methods will probably disappear as iterators
+// replace their functionality.
kukit.er.OperRegistry.prototype.getBoundOperForNode = function (name, node) {
- // Get the oper that is bound to a given eventname to a node in this binderinstance
+ // Get the oper that is bound to a given eventName
+ // to a node in this binderInstance
// returns null, if there is no such oper.
- var rules_per_name = this.infopername[name];
- if (typeof(rules_per_name) == 'undefined') {
+ var rulesPerName = this.infoPerName[name];
+ if (typeof(rulesPerName) == 'undefined') {
return null;
}
- var nodehash = kukit.rd.hashnode(node);
- var oper = rules_per_name[nodehash];
+ var nodeHash = kukit.rd.hashNode(node);
+ var oper = rulesPerName[nodeHash];
if (typeof(oper) == 'undefined') {
return null;
}
@@ -657,13 +708,14 @@
};
kukit.er.OperRegistry.prototype.getBoundOpers = function (name) {
- // Get the opers bound to a given eventname (to any node) in this binderinstance
+ // Get the opers bound to a given eventName (to any node)
+ // in this binderInstance
var opers = [];
- var rules_per_name = this.infopername[name];
- if (typeof(rules_per_name) != 'undefined') {
+ var rulesPerName = this.infoPerName[name];
+ if (typeof(rulesPerName) != 'undefined') {
// take the values as a list
- for (var nodehash in rules_per_name) {
- opers.push(rules_per_name[nodehash]);
+ for (var nodeHash in rulesPerName) {
+ opers.push(rulesPerName[nodeHash]);
}
}
// Return it
@@ -674,123 +726,140 @@
// The getBindIterator returns a function that gets executed on
// the oper registry.
//
-// Iterators receive the eventset as a parameter
-// plus a binderinstance and a method. They need to iterate by calling this
-// as method.call(binderinstance, ...); where ... can be any parameters this
+// Iterators receive the eventSet as a parameter
+// plus a binderInstance and a method. They need to iterate by calling this
+// as method.call(binderInstance, ...); where ... can be any parms this
// given iteration specifies.
//
-kukit.er.getBindIterator = function(itername) {
- return kukit.er.OperRegistry.prototype['iter_' + itername];
+kukit.er.getBindIterator = function(iterName) {
+ return kukit.er.OperRegistry.prototype['_iterate' + iterName];
};
-kukit.er.OperRegistry.prototype.call_bind_method = function (eventset, binderinstance, p1, p2, p3, p4, p5, p6) {
- var method = binderinstance[eventset.bindmethodname];
+kukit.er.OperRegistry.prototype.callBindMethod =
+ function (eventSet, binderInstance, p1, p2, p3, p4, p5, p6) {
+ var method = binderInstance[eventSet.bindMethodName];
// Protect the binding for better logging
- ;;; try {
- method.call(binderinstance, p1, p2, p3, p4, p5, p6);
- ;;; } catch(e) {
- ;;; throw new kukit.err.rd.EventBindError('Error during binding, reason: [' + e + ']', eventset.names, eventset.namespace);
- ;;; }
-};
-
-// This calls the bind method by each bound oper one by one. Eventname and func_to_bind are passed too.
-// this is the legacy ("each_legacy") way
-kukit.er.OperRegistry.prototype.iter_each_legacy = function (eventset, binderinstance) {
- for (var i=0; i<eventset.names.length; i++) {
- var rules_per_name = this.infopername[eventset.names[i]];
- if (typeof(rules_per_name) != 'undefined') {
- for (var nodehash in rules_per_name) {
- var oper = rules_per_name[nodehash];
- var eventname = oper.getEventName();
- var func_to_bind = oper.makeExecuteActionsHook();
- this.call_bind_method(eventset, binderinstance, eventname, func_to_bind, oper);
+;;; try {
+ method.call(binderInstance, p1, p2, p3, p4, p5, p6);
+;;; } catch(e) {
+;;; var msg = e;
+;;; var names = eventSet.names;
+;;; var namespace = eventSet.namespace;
+;;; kukit.E = new kukit.err.rd.EventBindError(msg, names, namespace);
+;;; throw kukit.E;
+;;; }
+};
+
+// This calls the bind method by each bound oper one by one.
+// Eventname and funcToBind are passed too.
+// this is the legacy ([EachLegacy]) way
+kukit.er.OperRegistry.prototype._iterateEachLegacy =
+ function (eventSet, binderInstance) {
+ for (var i=0; i<eventSet.names.length; i++) {
+ var rulesPerName = this.infoPerName[eventSet.names[i]];
+ if (typeof(rulesPerName) != 'undefined') {
+ for (var nodeHash in rulesPerName) {
+ var oper = rulesPerName[nodeHash];
+ var eventName = oper.getEventName();
+ var funcToBind = oper.makeExecuteActionsHook();
+ this.callBindMethod(eventSet, binderInstance, eventName,
+ funcToBind, oper);
}
}
}
};
-// This calls the bind method by each bound oper one by one. Eventname and func_to_bind are passed too.
-// this is the preferred ("each") way. Parameters are different from each_legacy.
-kukit.er.OperRegistry.prototype.iter_each = function (eventset, binderinstance) {
- for (var i=0; i<eventset.names.length; i++) {
- var rules_per_name = this.infopername[eventset.names[i]];
- if (typeof(rules_per_name) != 'undefined') {
- for (var nodehash in rules_per_name) {
- var oper = rules_per_name[nodehash];
- this.call_bind_method(eventset, binderinstance, oper);
+// This calls the bind method by each bound oper one by one.
+// Eventname and funcToBind are passed too.
+// this is the preferred ([Each]) way. Parameters are different from EachLegacy.
+kukit.er.OperRegistry.prototype._iterateEach =
+ function (eventSet, binderInstance) {
+ for (var i=0; i<eventSet.names.length; i++) {
+ var rulesPerName = this.infoPerName[eventSet.names[i]];
+ if (typeof(rulesPerName) != 'undefined') {
+ for (var nodeHash in rulesPerName) {
+ var oper = rulesPerName[nodeHash];
+ this.callBindMethod(eventSet, binderInstance, oper);
}
}
}
};
// This calls the bind method by the list of bound opers
-kukit.er.OperRegistry.prototype.iter_opers = function (eventset, binderinstance) {
+kukit.er.OperRegistry.prototype._iterateOpers =
+ function (eventSet, binderInstance) {
var opers = [];
- for (var i=0; i<eventset.names.length; i++) {
- var rules_per_name = this.infopername[eventset.names[i]];
- if (typeof(rules_per_name) != 'undefined') {
- for (var nodehash in rules_per_name) {
- opers.push(rules_per_name[nodehash]);
+ for (var i=0; i<eventSet.names.length; i++) {
+ var rulesPerName = this.infoPerName[eventSet.names[i]];
+ if (typeof(rulesPerName) != 'undefined') {
+ for (var nodeHash in rulesPerName) {
+ opers.push(rulesPerName[nodeHash]);
}
}
}
- this.call_bind_method(eventset, binderinstance, opers);
+ this.callBindMethod(eventSet, binderInstance, opers);
};
-// This calls the bind method by a mapping eventname:oper per each bound node individually
-kukit.er.OperRegistry.prototype.iter_node = function (eventset, binderinstance) {
- for (var nodehash in this.infopernode) {
- var rules_per_node = this.infopernode[nodehash];
+// This calls the bind method by a mapping eventName:oper
+// per each bound node individually
+kukit.er.OperRegistry.prototype._iterateNode =
+ function (eventSet, binderInstance) {
+ for (var nodeHash in this.infoPerNode) {
+ var rulesPerNode = this.infoPerNode[nodeHash];
// filter only the events we are interested in
- var filtered_rules = {};
- var foundoper = false;
- for (var i=0; i<eventset.names.length; i++) {
- var name = eventset.names[i];
- var oper = rules_per_node[name];
+ var filteredRules = {};
+ var operFound = false;
+ for (var i=0; i<eventSet.names.length; i++) {
+ var name = eventSet.names[i];
+ var oper = rulesPerNode[name];
if (typeof(oper) != 'undefined') {
- filtered_rules[name] = oper;
- foundoper = oper;
+ filteredRules[name] = oper;
+ operFound = oper;
}
}
// call it
- // All opers have the same node, the last one is yet in foundoper, so
+ // All opers have the same node, the last one is yet in operFound, so
// we use it as a second parameter to the call.
// The method may or may not want to use this.
- if (foundoper) {
- this.call_bind_method(eventset, binderinstance, filtered_rules, foundoper.node);
+ if (operFound) {
+ this.callBindMethod(eventSet, binderInstance, filteredRules,
+ operFound.node);
}
}
};
// This calls the bind method once per instance, by a list of
-// items, where item.node is the node and item.opers_by_eventname nodehash:item
-// in item there is item.node and item.opers_by_eventname
-kukit.er.OperRegistry.prototype.iter_allnodes = function (eventset, binderinstance) {
+// items, where item.node is the node and item.opersByEventName nodeHash:item
+// in item there is item.node and item.opersByEventName
+kukit.er.OperRegistry.prototype._iterateAllNodes =
+ function (eventSet, binderInstance) {
var items = [];
- var has_result = false;
- for (var nodehash in this.infopernode) {
- var rules_per_node = this.infopernode[nodehash];
+ var hasResult = false;
+ for (var nodeHash in this.infoPerNode) {
+ var rulesPerNode = this.infoPerNode[nodeHash];
// filter only the events we are interested in
- var filtered_rules = {};
- var foundoper = false;
- for (var i=0; i<eventset.names.length; i++) {
- var name = eventset.names[i];
- var oper = rules_per_node[name];
+ var filteredRules = {};
+ var operFound = false;
+ for (var i=0; i<eventSet.names.length; i++) {
+ var name = eventSet.names[i];
+ var oper = rulesPerNode[name];
if (typeof(oper) != 'undefined') {
- filtered_rules[name] = oper;
- foundoper = oper;
+ filteredRules[name] = oper;
+ operFound = oper;
}
}
- if (foundoper) {
- items.push({node: foundoper.node, opers_by_eventname: filtered_rules});
- has_result = true;
+ if (operFound) {
+ var item = {node: operFound.node,
+ opersByEventName: filteredRules};
+ items.push(item);
+ hasResult = true;
}
}
// call the binder method
- if (has_result) {
- this.call_bind_method(eventset, binderinstance, items);
+ if (hasResult) {
+ this.callBindMethod(eventSet, binderInstance, items);
}
};
Modified: kukit/kukit.js/trunk/kukit/forms.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/forms.js (original)
+++ kukit/kukit.js/trunk/kukit/forms.js Thu Aug 16 22:32:22 2007
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2005-2007
-* Authors: KSS Project Contributors (see docs/CREDITS.txt)
+* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -52,14 +52,16 @@
kukit.fo.FormQuery.prototype.appendElem = function(name, value) {
if (value == null) {
// do not marshall nulls
- ;;; var msg = "parameter '" + name + "' is null.";
- ;;; kukit.logDebug(msg);
+;;; var msg = "Parameter '" + name + "' is null,";
+;;; msg += " it is not marshalled.";
+;;; kukit.logDebug(msg);
}
else if (typeof(value) == 'string') {
var elem = new kukit.fo.FormQueryElem(name, value);
this.l.push(elem);
}
- else if (typeof(value) == 'object' && value.constructor.toString().indexOf('Array') != -1) {
+ else if (typeof(value) == 'object' &&
+ value.constructor.toString().indexOf('Array') != -1) {
// Special marshalling of arrays
for (var i=0; i < value.length; i++) {
var elem = new kukit.fo.FormQueryElem(name, value[i]);
@@ -69,7 +71,8 @@
else if (typeof(value) == 'object') {
// Special marshalling of dicts
for (var key in value) {
- var qkey = kukit.fo.dictprefix + name + kukit.fo.dictseparator + key + kukit.fo.dictpostfix;
+ var qkey = kukit.fo.dictprefix + name + kukit.fo.dictseparator;
+ qkey += key + kukit.fo.dictpostfix;
var elem = new kukit.fo.FormQueryElem(qkey, value[key]);
this.l.push(elem);
}
@@ -133,7 +136,7 @@
kukit.fo.CurrentFormLocator.prototype.getForm = function() {
var form = this.queryForm();
if (!form) {
- ;;; kukit.logWarning("No form found");
+;;; kukit.logWarning("No form found");
return null;
}
return form;
@@ -153,7 +156,8 @@
return document.forms[this.formname];
};
-kukit.fo.NamedFormLocator.prototype.getForm = kukit.fo.CurrentFormLocator.prototype.getForm;
+kukit.fo.NamedFormLocator.prototype.getForm =
+ kukit.fo.CurrentFormLocator.prototype.getForm;
/* methods to take the desired value(s) from the form */
@@ -164,29 +168,30 @@
kukit.fo.fieldUpdateRegistry.doUpdate(element);
// Collect the data
if (element.selectedIndex != undefined) {
- // handle single selects first
- if(!element.multiple){
- if (element.selectedIndex < 0) {
- value="";
- } else {
- var option = element.options[element.selectedIndex];
- value = option.value;
- if (value == "")
- value = option.text;
+ // handle single selects first
+ if(!element.multiple) {
+ if (element.selectedIndex < 0) {
+ value="";
+ } else {
+ var option = element.options[element.selectedIndex];
+ value = option.value;
+ if (value == "") {
+ value = option.text;
+ }
+ }
+ // Now process selects with the multiple option set
+ } else {
+ var value = [];
+ for(i=0; i<element.options.length; i++) {
+ var option = element.options[i];
+ if(option.selected) {
+ value.push(option.value);
+ }
}
- }
- // Now process selects with the multiple option set
- else {
- var value = [];
- for(i=0; i<element.options.length; i++){
- var option = element.options[i];
- if(option.selected){
- value.push(option.value);
- }
- }
- return value;
- }
- } else if (typeof element.length != 'undefined' && typeof element.item != 'undefined' && element.item(0).type == "radio") {
+ }
+ } else if (typeof element.length != 'undefined' &&
+ typeof element.item != 'undefined' &&
+ element.item(0).type == "radio") {
var radioList = element;
value = null;
for (var i=0; i < radioList.length; i++) {
@@ -221,13 +226,13 @@
var element = form[name];
if (element) {
var value = kukit.fo.getValueOfFormElement(element);
- ;;; if (value != null) {
- ;;; kukit.logDebug("Form element ("+element.tagName+"): name="+element.name+", value="+value);
- ;;; // } else {
- ;;; // kukit.logWarning('Form element not harvested: '+element.tagName);
- ;;; }
- ;;; } else {
- ;;; kukit.logWarning('Form element '+ name + '" not found in form.');
+;;; if (value != null) {
+;;; var msg = "Form element [" + element.tagName + "] : name = ";
+;;; msg += element.name + ", value = " + value + '.';
+;;; kukit.logDebug(msg);
+;;; }
+;;; } else {
+;;; kukit.logWarning('Form element [' + name + '] not found in form.');
}
return value;
};
@@ -243,10 +248,10 @@
var element = elements[y];
var value = kukit.fo.getValueOfFormElement(element);
if (value != null) {
- ;;; kukit.logDebug("Form element ("+element.tagName+"): name="+element.name+", value="+value);
+;;; var msg = "Form element [" + element.tagName + "] : name = ";
+;;; msg += element.name + ", value = " + value + '.';
+;;; kukit.logDebug(msg);
collector.add(element.name, value);
- ;;; // } else {
- ;;; // kukit.logWarning('Form element not harvested: '+element.tagName);
}
}
return collector.result;
@@ -271,9 +276,9 @@
};
kukit.fo.FieldUpdateRegistry.prototype.register = function(node, editor) {
- var hash = kukit.rd.hashnode(node);
+ var hash = kukit.rd.hashNode(node);
if (typeof(this.editors[hash]) != 'undefined') {
- ;;; kukit.E = 'Double registration of editor update on node.';
+;;; kukit.E = 'Double registration of editor update on node.';
throw kukit.E;
}
this.editors[hash] = editor;
@@ -283,7 +288,7 @@
};
kukit.fo.FieldUpdateRegistry.prototype.doUpdate = function(node) {
- var hash = kukit.rd.hashnode(node);
+ var hash = kukit.rd.hashNode(node);
var editor = this.editors[hash];
if (typeof(editor) != 'undefined') {
editor.doUpdate(node);
@@ -296,42 +301,39 @@
// Registry of the pprovider functions for kssSubmitForm
-kukit.fo.pproviderFormRegistry = new kukit.pr.ParamProviderRegistry();
+kukit.fo.pproviderFormRegistry = new kukit.pr.ValueProviderRegistry();
-// form, currentForm will provide identical functions do those in normal parameters
+// form, currentForm will provide identical functions to those
+// in normal parameters
// except they return a tuple list, not a dictionary.
// This is needed because duplications and order must be preserved.
kukit.fo.FormPP = function() {};
kukit.fo.FormPP.prototype = {
- /*
- ;;; */
check: function(args) {
- if (args.length != 1) {
- throw 'form method needs 1 arguments (formname)';
- }
+;;; if (args.length != 1) {
+;;; throw 'form method needs 1 arguments (formname)';
+;;; }
},
- /*
- */
eval: function(args, node) {
- return kukit.fo.getAllFormVars(new kukit.fo.NamedFormLocator(args[0]), new kukit.ut.TupleCollector());
+ var locator = new kukit.fo.NamedFormLocator(args[0]);
+ var collector = new kukit.ut.TupleCollector();
+ return kukit.fo.getAllFormVars(locator, collector);
}
};
kukit.fo.pproviderFormRegistry.register('form', kukit.fo.FormPP);
kukit.fo.CurrentFormPP = function() {};
kukit.fo.CurrentFormPP.prototype = {
- /*
- ;;; */
check: function(args) {
- if (args.length != 0) {
- throw 'currentForm method needs no argument';
- }
+;;; if (args.length != 0) {
+;;; throw 'currentForm method needs no argument';
+;;; }
},
- /*
- */
eval: function(args, node) {
- return kukit.fo.getAllFormVars(new kukit.fo.CurrentFormLocator(node), new kukit.ut.TupleCollector());
+ var locator = new kukit.fo.NamedFormLocator(node);
+ var collector = new kukit.ut.TupleCollector();
+ return kukit.fo.getAllFormVars(locator, collector);
}
};
kukit.fo.pproviderFormRegistry.register('currentForm', kukit.fo.CurrentFormPP);
@@ -341,30 +343,46 @@
kukit.fo.pproviderFormRegistry.register('', kukit.fo.FormPP);
-/* BBB. To be deprecated at 2007-06-15 */
+/* BBB. To be deprecated on 2008-06-15 */
kukit.fo.getCurrentForm = function(target) {
- ;;; kukit.logWarning('Deprecated kukit.fo.getCurrentForm(target), new kukit.fo.CurrentFormLocator(target).getForm() instead!');
+;;; var msg = 'Deprecated kukit.fo.getCurrentForm(target), use new ';
+;;; msg += 'kukit.fo.CurrentFormLocator(target).getForm() instead!';
+;;; kukit.logWarning(msg);
return new kukit.fo.CurrentFormLocator(target).getForm();
};
kukit.fo.getFormVarFromCurrentForm = function(target, name) {
- ;;; kukit.logWarning('Deprecated kukit.fo.getFormVarFromCurrentForm(target, name), use kukit.fo.getFormVar(new kukit.fo.CurrentFormLocator(target), name) instead!');
+;;; var msg = 'Deprecated kukit.fo.getFormVarFromCurrentForm(target, name),';
+;;; msg += ' use kukit.fo.getFormVar(new kukit.fo.CurrentFormLocator(target),';
+;;; msg += ' name) instead!';
+;;; kukit.logWarning(msg);
return kukit.fo.getFormVar(new kukit.fo.CurrentFormLocator(target), name);
};
kukit.fo.getFormVarFromNamedForm = function(formname, name) {
- ;;; kukit.logWarning('Deprecated kukit.fo.getFormVarFromNamedForm(formname, name), use kukit.fo.getFormVar(new kukit.fo.NamedFormLocator(formname), name) instead!');
+;;; var msg = 'Deprecated kukit.fo.getFormVarFromNamedForm(formname, name),';
+;;; msg += ' use kukit.fo.getFormVar(new kukit.fo.NamedFormLocator(formname),';
+;;; msg += ' name) instead!';
+;;; kukit.logWarning(msg);
return kukit.fo.getFormVar(new kukit.fo.NamedFormLocator(formname), name);
};
kukit.fo.getAllFormVarsFromCurrentForm = function(target) {
- ;;; kukit.logWarning('Deprecated kukit.fo.getAllFormVarsFromCurrentForm(target), use kukit.fo.getAllFormVars(new kukit.fo.CurrentFormLocator(target), new kukit.ut.DictCollector()) instead!');
- return kukit.fo.getAllFormVars(new kukit.fo.CurrentFormLocator(target), new kukit.ut.DictCollector());
+;;; var msg = 'Deprecated kukit.fo.getAllFormVarsFromCurrentForm(target),';
+;;; msg += ' use kukit.fo.getAllFormVars(new kukit.fo.CurrentFormLocator';
+;;; msg += '(target), new kukit.ut.DictCollector()) instead!';
+;;; kukit.logWarning(msg);
+ return kukit.fo.getAllFormVars(new kukit.fo.CurrentFormLocator(target),
+ new kukit.ut.DictCollector());
};
kukit.fo.getAllFormVarsFromNamedForm = function(formname) {
- ;;; kukit.logWarning('Deprecated kukit.fo.getAllFormVarsFromNamedtForm(formname), use kukit.fo.getAllFormVars(new kukit.fo.NamedFormLocator(formname), new kukit.ut.DictCollector()) instead!');
- return kukit.fo.getAllFormVars(new kukit.fo.NamedFormLocator(formname), new kukit.ut.DictCollector());
+;;; var msg = 'Deprecated kukit.fo.getAllFormVarsFromNamedtForm(formname), ';
+;;; msg += 'use kukit.fo.getAllFormVars(new kukit.fo.NamedFormLocator';
+;;; msg += '(formname), new kukit.ut.DictCollector()) instead!';
+;;; kukit.logWarning(msg);
+ return kukit.fo.getAllFormVars(new kukit.fo.NamedFormLocator(formname),
+ new kukit.ut.DictCollector());
};
Modified: kukit/kukit.js/trunk/kukit/kssparser.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/kssparser.js (original)
+++ kukit/kukit.js/trunk/kukit/kssparser.js Thu Aug 16 22:32:22 2007
@@ -1,7 +1,6 @@
/*
* Copyright (c) 2005-2007
-* Authors: KSS Project Contributors (see docs/CREDITS.txt)
-* Martin Heidegger <mastakaneda at gmail.com>
+* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -18,7 +17,7 @@
* 02111-1307, USA.
*/
-/* Tokens of the kss parser */
+/* Tokens of the KSS parser */
kukit.kssp = {};
@@ -68,20 +67,27 @@
// Parse the part in an embedded parser
var src = new kukit.tk.Cursor(key + ' ');
var parser = new kukit.kssp.KssSelector(src, null, true);
- // check the event name and namespace use in evt- parameters
- // equals the event name and namespace set in the kss selector.
+ // check the event name and namespace use in evt- rules
+ // equals the event name and namespace set in the KSS selector.
if (block.evt_name != null) {
// We have evt- parms in the rule.
- if (block.evt_name != parser.kssSelector.name || block.evt_namespace != parser.kssSelector.namespace) {
- // XXX this should be done in another way, so that we can see where the error happened.
- ;;; kukit.E = 'kss param key evt-[<namespace>-]<name>-yyy must not have different ';
- ;;; kukit.E += '[namespace and] name then the kss selector at the top of the rule, "';
- ;;; kukit.E += key + '", and inside we have "' + block.evt_namespace + '-' + block.evt_name + '"';
+ if (block.evt_name != parser.kssSelector.name
+ || block.evt_namespace != parser.kssSelector.namespace) {
+ // XXX this should be done in another way,
+ //so that we can see where the error happened.
+;;; kukit.E = 'Wrong prefix : we have "' + block.evt_namespace;
+;;; kukit.E += '-' + block.evt_name + '" instead of "' + key;
+;;; kukit.E += '". KSS prefix ';
+;;; kukit.E += '"evt-[<NAMESPACE>-]<EVENTNAME>-<NAME>" ';
+;;; kukit.E += 'must not have different [namespace and] ';
+;;; kukit.E += 'name than the KSS selector at the top of the ';
+;;; kukit.E += 'rule.';
block.emitError(kukit.E);
}
}
// Create the event rule. (one action only)
- var eventRule = new kukit.rd.EventRule(parser.kssSelector, block.evt_parms, block.actions);
+ var eventRule = new kukit.rd.EventRule(parser.kssSelector,
+ block.eventParameters, block.actions);
// Store the rule
this.eventRules.push(eventRule);
};
@@ -108,7 +114,7 @@
});
kukit.kssp.Block.prototype.process = function() {
//this.parms = {};
- this.evt_parms = {};
+ this.eventParameters = {};
this.evt_name = null; // we don't know at this point
this.evt_namespace = null; // we don't know at this point
this.actions = new kukit.rd.ActionSet();
@@ -158,70 +164,98 @@
// default-error: <VALUE>
//
var splitkey = key.split('-');
- ;;; if (splitkey.length < 2 || splitkey.length > 4) {
- ;;; this.emitError('kss param key must be like xxx-yyy or nnn-xxx-yyy or evt-xxx-yyy or evt-nnn-xxx-yyy"' + key + '"');
- ;;; }
+;;; if (splitkey.length < 2 || splitkey.length > 4) {
+;;; kukit.E = 'Wrong rule key : "' + key + '". ';
+;;; kukit.E += 'KSS rule key must be "<ACTIONNAME>-<PARAMETER>" or ';
+;;; kukit.E += '"<NAMESPACE>-<ACTIONNAME>-<PARAMETER>" or ';
+;;; kukit.E += '"evt-<EVENTNAME>-<PARAMETER>" or ';
+;;; kukit.E += '"evt-<NAMESPACE>-<EVENTNAME>-<PARAMETER>".';
+;;; this.emitError(kukit.E);
+;;; }
var name = splitkey[0];
if (name == 'evt') {
- // evt-<EVTNAME>-<KEY>: <VALUE>
- // evt-<NAMESPACE>-<EVTNAME>-<KEY>: <VALUE>
- ;;; if (splitkey.length < 3) {
- ;;; this.emitError('kss param key must be like xxx-yyy or nnn-xxx-yyy or evt-xxx-yyy or evt-nnn-xxx-yyy"' + key + '"');
- ;;; }
+ // evt-<EVTNAME>-<PARAMETER>: <VALUE>
+ // evt-<NAMESPACE>-<EVTNAME>-<PARAMETER>: <VALUE>
+;;; if (splitkey.length < 3) {
+;;; kukit.E = 'Wrong rule key : "' + key + '". ';
+;;; kukit.E += 'KSS rule key must be "<ACTIONNAME>-<PARAMETER>"';
+;;; kukit.E += ' or "<NAMESPACE>-<ACTIONNAME>-<PARAMETER>" or ';
+;;; kukit.E += '"evt-<EVENTNAME>-<PARAMETER>" or ';
+;;; kukit.E += '"evt-<NAMESPACE>-<EVENTNAME>-<PARAMETER>".';
+;;; this.emitError(kukit.E);
+;;; }
var enamespace;
var ename;
var ekey;
if (splitkey.length == 3) {
- // evt-<EVTNAME>-<KEY>: <VALUE>
+ // evt-<EVENTNAME>-<PARAMETER>: <VALUE>
ename = splitkey[1];
ekey = splitkey[2];
} else {
- // evt-<NAMESPACE>-<EVTNAME>-<KEY>: <VALUE>
+ // evt-<NAMESPACE>-<EVENTNAME>-<PARAMETER>: <VALUE>
enamespace = splitkey[1];
ename = splitkey[2];
ekey = splitkey[3];
}
if (this.evt_name == null) {
- // This is the first evt- parameter, so we set it up
+ // This is the first evt- rule, so we set it up
// so that we can check it stays the same within the block.
this.evt_name = ename;
this.evt_namespace = enamespace;
- ;;; } else {
- ;;; if (ename != this.evt_name || enamespace != this.evt_namespace) {
- ;;; // Do not allow deviation from the previous event names.
- ;;; kukit.E = 'kss param key evt-[<namespace>-]<name>-yyy must not have different ';
- ;;; kukit.E += '[namespace and] name inside the same rule,"' + key + '", it must be "';
- ;;; kukit.E += this.evt_namespace + '-' + this.evt_name + '"';
- ;;; this.emitError(kukit.E);
- ;;; }
- ;;; }
- ;;; if (value.isMethod != false) {
- ;;; this.emitError('evt-[nnn-]xxx-yyy: parameter producers are not allowed as value, key "' + key + '"');
+;;; } else {
+;;; if (ename != this.evt_name || enamespace != this.evt_namespace) {
+;;; // Do not allow deviation from the previous event names.
+;;; kukit.E = 'Wrong key [' + key + '] : ';
+;;; kukit.E += 'evt-[<NAMESPACE>-]<EVENTNAME>-<PARAMETER> ';
+;;; kukit.E += 'keys cannot have different [namespace and] ';
+;;; kukit.E += 'event name than in the event selector, ';
+;;; kukit.E += 'it should have been [' + this.evt_namespace;
+;;; kukit.E += '-' + this.evt_name + '].';
+;;; this.emitError(kukit.E);
+;;; }
+;;; }
+;;; if (value.isMethod != false) {
+;;; kukit.E = 'Wrong value for key [' + key + '] : ';
+;;; kukit.E += 'value providers are not ';
+;;; kukit.E += 'allowed as value for ';
+;;; kukit.E += 'evt-[<NAMESPACE>-]<EVENTNAME>-<PARAMETER> keys.';
+;;; this.emitError(kukit.E);
}
// set it
- this.evt_parms[ekey] = value.txt;
+ this.eventParameters[ekey] = value.txt;
} else if (name == 'action') {
// action-server: <ACTIONNAME>
// action-client: <ACTIONNAME>
// action-client: <NAMESPACE>-<ACTIONNAME>
// action-cancel: <ACTIONNAME>
// action-cancel: <NAMESPACE>-<ACTIONNAME>
- ;;; if (splitkey.length != 2) {
- ;;; this.emitError('action-xxx must not have more "-" in it, key "' + key + '"');
- ;;; }
- ;;; if (value.isMethod != false) {
- ;;; this.emitError('action-xxx: parameter producers are not allowed as value, key "' + key + '"');
- ;;; }
+;;; if (splitkey.length != 2) {
+;;; kukit.E = 'Wrong key [' + key + '] : ';
+;;; kukit.E += 'action-<QUALIFIER> keys can have only one dash.';
+;;; this.emitError(kukit.E);
+;;; }
+;;; if (value.isMethod != false) {
+;;; kukit.E = 'Wrong value for key [' + key + '] : ';
+;;; kukit.E += 'value providers are not ';
+;;; kukit.E += 'allowed for action-<QUALIFIER> keys.';
+;;; this.emitError(kukit.E);
+;;; }
var atab = {'server': 'S', 'client': 'C', 'cancel': 'X'};
var actionType = atab[splitkey[1]];
- ;;; if (! actionType) {
- ;;; this.emitError('action-xxx: key must be action-server or action-client or action-cancel, key "' + key + '"');
- ;;; }
- ;;; // force value to be <ACTIONNAME> or <NAMESPACE>-<ACTIONNAME>
- ;;; var splitvalue = value.txt.split('-');
- ;;; if (splitvalue.length > 2) {
- ;;; this.emitError('action-xxx: value must be <ACTIONNAME> or <NAMESPACE>-<ACTIONNAME>, key "' + key + '"');
- ;;; }
+;;; if (! actionType) {
+;;; kukit.E = 'Wrong key [' + key + '] : ';
+;;; kukit.E += 'qualifier in action-<QUALIFIER> keys must be ';
+;;; kukit.E += '"server" or "client" or "cancel".';
+;;; this.emitError(kukit.E);
+;;; }
+;;; // force value to be <ACTIONNAME> or <NAMESPACE>-<ACTIONNAME>
+;;; var splitvalue = value.txt.split('-');
+;;; if (splitvalue.length > 2) {
+;;; kukit.E = 'Wrong value for key [' + key + '] : ';
+;;; kukit.E += 'value must be <ACTIONNAME> or <NAMESPACE>';
+;;; kukit.E += '-<ACTIONNAME> for action-<QUALIFIER> keys.';
+;;; this.emitError(kukit.E);
+;;; }
// set it
var action = this.actions.getOrCreateAction(value.txt);
if (actionType != 'X' || action.type == null) {
@@ -257,9 +291,12 @@
case 'error': {
// <ACTIONNAME>-error: <VALUE>
// default-error: <VALUE>
- ;;; if (value.isMethod != false) {
- ;;; this.emitError('xxx-error: parameter producers are not allowed as value, key "' + key + '"');
- ;;; }
+;;; if (value.isMethod != false) {
+;;; kukit.E = 'Wrong value for key [' + key + '] : ';
+;;; kukit.E += 'value providers are not ';
+;;; kukit.E += 'allowed for <ACTIONNAME>-error keys.';
+;;; this.emitError(kukit.E);
+;;; }
action.setError(value.txt);
// also create the action for the error itself.
var err_action = this.actions.getOrCreateAction(value.txt);
@@ -269,12 +306,13 @@
// <ACTIONNAME>-<KEY>: <VALUE>
// default-<KEY>: <VALUE>
//
- // value may be either txt or method parms, and they get stored with the wrapper.
+ // value may be either txt or method parms,
+ // and they get stored with the wrapper.
action.parms[akey] = value;
//
- // Check the syntax of the value at this point. This will also set
- // the paramproviders on the value (from check).
- // check the syntax of the declaration
+ // Check the syntax of the value at this point.
+ // This will also set the value providers on the value
+ // (from check).
//
// Figure out which registry to use.
var registry = ppRegistries[akey];
@@ -284,11 +322,11 @@
}
//
try {
- // Check also sets the parameter provider on the value.
+ // Check also sets the value provider on the value.
value.check(registry);
} catch(e) {
- ;;; kukit.E = new kukit.err.tk.ParsingError('Error in value: ' + e, this.src.makeMarker(this.startpos));
- throw kukit.E;
+;;; kukit.E = 'Error in value : ' + e + '.';
+ this.emitError(kukit.E);
}
} break;
}
@@ -316,7 +354,8 @@
if (this.ifToken(cursor, kukit.kssp.String)) {
// The previous txt must be all whitespace.
if (txt) {
- ;;; kukit.E = 'Excess characters before the string in property value';
+;;; kukit.E = 'Wrong value : unallowed characters [' + txt + ']';
+;;; kukit.E += ' before a string.';
this.emitError(kukit.E);
}
// the next one must be a string.
@@ -325,16 +364,17 @@
} else if (this.ifToken(cursor, kukit.kssp.MethodArgs)) {
// see if not empty and has no spaces in it
if (! txt || txt.indexOf(' ') != -1) {
- ;;; kukit.E = 'Method property value must have a one-word method name';
+;;; kukit.E = 'Wrong value : method name [' + txt + '] cannot ';
+;;; kukit.E += 'have spaces.';
this.emitError(kukit.E);
}
- // the next one must be the params
+ // the next one must be the rules
this.expectToken(cursor, kukit.kssp.MethodArgs);
this.value = new this.valueClass(txt, cursor.token.args);
} else {
// not a string or method: check if we allowed multiword.
if (! this.multiword_allowed && txt.indexOf(' ') != -1) {
- ;;; kukit.E = 'Property value must be one word';
+;;; kukit.E = 'Wrong value : [' + txt + '] cannot have spaces.';
this.emitError(kukit.E);
}
this.produceTxt(txt);
@@ -344,7 +384,8 @@
this.digestTxt(cursor, kukit.tk.Fraction, kukit.kssp.Comment);
// we have to be at the end and have no text after
if (cursor.next < this.result.length || cursor.txt) {
- ;;; kukit.E = 'Excess characters after the property value';
+;;; kukit.E = 'Wrong value : unallowed characters after ';
+;;; kukit.E += 'the property.';
this.emitError(kukit.E);
}
}
@@ -360,7 +401,7 @@
/*
* class PropValueInMethod
*
-* PropValue in method cannot contain method-style vars.
+* PropValue in method cannot have method-style vars.
*/
kukit.kssp.PropValueInMethod = kukit.tk.mkParser('propvalue', {
";": 'this.emitAndReturn()',
@@ -370,10 +411,11 @@
",": 'this.emitAndReturn()',
"'": 'new kukit.kssp.String(this.src, kukit.kssp.quote)',
'"': 'new kukit.kssp.String2(this.src, kukit.kssp.dquote)',
- "\/\*": 'new kukit.kssp.Comment(this.src, kukit.kssp.commentbegin)' //,
+ "\/\*": 'new kukit.kssp.Comment(this.src, kukit.kssp.commentbegin)'
});
kukit.kssp.PropValueInMethod.prototype.multiword_allowed = false;
-kukit.kssp.PropValueInMethod.prototype.process = kukit.kssp.PropValue.prototype.process;
+kukit.kssp.PropValueInMethod.prototype.process =
+ kukit.kssp.PropValue.prototype.process;
kukit.kssp.PropValueInMethod.prototype.produceTxt = function(txt) {
// txt parms are returned unwrapped
this.txt = txt;
@@ -392,10 +434,12 @@
"\r": 'this.emitAndReturn()',
"\/\*": 'this.emitAndReturn()',
":": 'this.emitAndReturn()',
- "(": 'this.emitAndReturn(new kukit.kssp.MethodArgs(this.src, kukit.kssp.openparent))'
+ "(": 'this.emitAndReturn(new kukit.kssp.MethodArgs(this.src,' +
+ 'kukit.kssp.openparent))'
});
kukit.kssp.PropValueInPseudo.prototype.multiword_allowed = false;
-kukit.kssp.PropValueInPseudo.prototype.process = kukit.kssp.PropValue.prototype.process;
+kukit.kssp.PropValueInPseudo.prototype.process =
+ kukit.kssp.PropValue.prototype.process;
kukit.kssp.PropValueInPseudo.prototype.valueClass = kukit.rd.KssPseudoValue;
kukit.kssp.PropValueInPseudo.prototype.produceTxt = function(txt) {
// txt parms are returned embedded
@@ -436,7 +480,7 @@
var src = this.src;
var length = src.text.length;
if (length < src.pos + 1) {
- ;;; kukit.E = 'Missing character after backslash';
+;;; kukit.E = 'Missing character after backslash.';
this.emitError(kukit.E);
} else {
this.result.push(new kukit.tk.Fraction(src, src.pos+1));
@@ -475,7 +519,9 @@
} else {
// Just a value, must be one word then.
if (value.indexOf(' ') != -1) {
- ;;; kukit.E = 'Argument value must be one word or a string';
+;;; kukit.E = 'Wrong method argument [' + value;
+;;; kukit.E += '] : value cannot have spaces (if needed,';
+;;; kukit.E += ' quote it as a string).';
this.emitError(kukit.E);
}
}
@@ -491,13 +537,14 @@
* class KssSelector
*
* embedded parser to parse the selector
-* kss event selector: (has spaces in it)
+* KSS event selector: (has spaces in it)
* <css selector> selector:name(id)
-* kss method selector: (has no spaces in it)
+* KSS method selector: (has no spaces in it)
* document:name(id) or behaviour:name(id)
*/
kukit.kssp.KssSelector = kukit.tk.mkParser('kssselector', {
- ":": '[new kukit.kssp.colon(this.src), new kukit.kssp.PropValueInPseudo(this.src)]',
+ ":": '[new kukit.kssp.colon(this.src), new ' +
+ 'kukit.kssp.PropValueInPseudo(this.src)]',
"{": 'this.emitAndReturn()',
"\/\*": 'new kukit.kssp.Comment(this.src, kukit.kssp.commentbegin)'
});
@@ -516,8 +563,9 @@
if (token.txt.match(/^[\r\n\t ]*$/) != null) {
tokenindex -= 1;
} else {
- // Error.
- ;;; kukit.E = 'Kss event selector must end with an event qualifier :event or :event(id)';
+;;; kukit.E = 'Wrong event selector : missing event ';
+;;; kukit.E += 'qualifier :<EVENTNAME> ';
+;;; kukit.E += 'or :<EVENTNAME>(<ID>).';
this.emitError(kukit.E);
}
} break;
@@ -530,12 +578,16 @@
}
}
// Now we found the token that must be <fraction> <colon> <propvalue>.
- tokenindex -= 2
+ tokenindex -= 2;
if (tokenindex < 0
- || this.result[tokenindex+2].symbol != kukit.kssp.PropValueInPseudo.prototype.symbol
- || this.result[tokenindex+1].symbol != kukit.kssp.colon.prototype.symbol
- || this.result[tokenindex].symbol != kukit.tk.Fraction.prototype.symbol) {
- ;;; kukit.E = 'Kss event selector must end with an event qualifier :event or :event(id)';
+ || (this.result[tokenindex+2].symbol !=
+ kukit.kssp.PropValueInPseudo.prototype.symbol)
+ || (this.result[tokenindex+1].symbol !=
+ kukit.kssp.colon.prototype.symbol)
+ || (this.result[tokenindex].symbol !=
+ kukit.tk.Fraction.prototype.symbol)) {
+;;; kukit.E = 'Wrong event selector : missing event qualifier ';
+;;; kukit.E += ':<EVENTNAME> or :<EVENTNAME>(<ID>).';
this.emitError(kukit.E);
}
// See that the last fraction does not end with space.
@@ -544,19 +596,21 @@
var pseudotoken = this.result[tokenindex+2];
var txt = lasttoken.txt;
if (txt.match(/[\r\n\t ]$/) != null) {
- ;;; kukit.E = 'In kss event selector no space can be before the colon';
+;;; kukit.E = 'Wrong event selector :';
+;;; kukit.E += ' space before the colon.';
this.emitError(kukit.E);
}
- if (! pseudotoken.value.methodname) {
- ;;; kukit.E = 'Kss event selector must have a one-word name after the colon';
+ if (! pseudotoken.value.methodName) {
+;;; kukit.E = 'Wrong event selector :';
+;;; kukit.E += ' event name cannot have spaces.';
this.emitError(kukit.E);
}
if (pseudotoken.value.args.length > 1) {
- ;;; kukit.E = 'Kss pseudo value must not have more then one parameters';
+;;; kukit.E = 'Wrong event selector :';
+;;; kukit.E += ':<EVENTNAME>(<ID>) can have only one parameter.';
this.emitError(kukit.E);
}
css = this.src.text.substring(this.startpos, commatoken.startpos);
- //print ('>>' + css + ':' + pseudotoken.value.methodname);
// Decide if we have an event or a method selector.
// We have a method selector if a single word "document" or "behaviour".
var singleword = css.replace(/[\r\n\t ]/g, ' ');
@@ -573,27 +627,30 @@
if (pseudotoken.value.args.length == 1) {
id = pseudotoken.value.args[0];
}
- var name = pseudotoken.value.methodname;
+ var name = pseudotoken.value.methodName;
var splitname = name.split('-');
var namespace = null;
if (splitname.length > 2) {
- ;;; kukit.E = 'Kss event selector must be name or namespace-name but no more dashes, "' + name + '"';
+;;; kukit.E = 'Wrong event selector [' + name + '] : ';
+;;; kukit.E += 'qualifier should be :<EVENTNAME> or ';
+;;; kukit.E += ':<NAMESPACE>-<EVENTNAME>.';
this.emitError(kukit.E);
} else if (splitname.length == 2) {
name = splitname[1];
namespace = splitname[0];
}
// Protect the error for better logging
- ;;; try {
- this.kssSelector = new kukit.rd.KssSelector(isEvent, css, name, namespace, id);
- ;;; } catch(e) {
- ;;; if (e.name == 'KssSelectorError') {
- ;;; // Log the message
- ;;; this.emitError(e.toString());
- ;;; } else {
- ;;; throw e;
- ;;; }
- ;;; }
+;;; try {
+ this.kssSelector = new kukit.rd.KssSelector(isEvent, css, name,
+ namespace, id);
+;;; } catch(e) {
+;;; if (e.name == 'KssSelectorError') {
+;;; // Log the message
+;;; this.emitError(e.toString());
+;;; } else {
+;;; throw e;
+;;; }
+;;; }
this.txt = '';
this.result = [];
};
@@ -606,6 +663,7 @@
kukit.kssp.KssRuleProcessor = function(href) {
this.href = href;
this.loaded = false;
+ this.rules = [];
};
kukit.kssp.KssRuleProcessor.prototype.load = function() {
@@ -618,20 +676,35 @@
};
kukit.kssp.KssRuleProcessor.prototype.parse = function() {
- //Build a parser and parse the text into it
- var src = new kukit.tk.Cursor(this.txt);
- var parser = new kukit.kssp.Document(src, null, true);
- // Store event rules in the common list
- for (var i=0; i<parser.eventRules.length; i++) {
- var rule = parser.eventRules[i];
- // finish up the kss on it
- ;;; try {
- rule.kss_selector.setIdAndClass();
- ;;; } catch(e) {
- ;;; // foolishly, we don't know the position at this point
- ;;; throw new kukit.err.tk.ParsingError('Undefined event name="' + rule.kss_selector.name + '", namespace="' + rule.kss_selector.namespace + '"');
- ;;; }
- kukit.engine.rules.push(rule);
- }
+;;; try {
+ //Build a parser and parse the text into it
+ var src = new kukit.tk.Cursor(this.txt);
+ var parser = new kukit.kssp.Document(src, null, true);
+ // Store event rules in the common list
+ for (var i=0; i<parser.eventRules.length; i++) {
+ var rule = parser.eventRules[i];
+ // finish up the KSS on it
+;;; try {
+ rule.kssSelector.setIdAndClass();
+;;; } catch(e) {
+;;; // foolishly, we don't know the position at this point
+;;; kukit.E = 'Undefined event : [';
+;;; kukit.E += rule.kssSelector.namespace;
+;;; kukit.E += ':' + rule.kssSelector.name + '].';
+;;; throw new kukit.err.tk.ParsingError(kukit.E);
+;;; }
+ this.rules.push(rule);
+ }
+;;; } catch(e) {
+;;; // ParsingError are logged.
+;;; if (e.name == 'ParsingError') {
+;;; var msg = 'Error parsing KSS at ' + this.href;
+;;; msg += ' : ' + e.toString();
+;;; kukit.logFatal(msg);
+;;; throw msg;
+;;; } else {
+;;; throw e;
+;;; }
+;;; }
};
Modified: kukit/kukit.js/trunk/kukit/kukit.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/kukit.js (original)
+++ kukit/kukit.js/trunk/kukit/kukit.js Thu Aug 16 22:32:22 2007
@@ -1,9 +1,6 @@
/*
-* Copyright (c) 2005-2006
-* Authors:
-* Godefroid Chapelle <gotcha at bubblenet.be>
-* Florian Schulze <florian.schulze at gmx.net>
-* Balázs Reé <ree at greenfinity.hu>
+* Copyright (c) 2005-2007
+* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -33,10 +30,9 @@
// register processor for type kss
this._ruleProcessorClasses['kss'] = kukit.kssp.KssRuleProcessor;
this._ruleProcessors = new Array();
- this.rules = new Array();
this.bindScheduler = new kukit.ut.SerializeScheduler();
// State vars storage. This can be used from kss via a method.
- this.statevars = {};
+ this.stateVariables = {};
// instantiate request manager
this.requestManager = new kukit.rm.RequestManager();
this.binderInfoRegistry = new kukit.er.BinderInfoRegistry();
@@ -94,12 +90,47 @@
if((nodes[i].type == 'text/css') || (nodes[i].type == 'text/kss')) {
res_type = 'kss';
}
- results[results.length] = new kukit.RuleSheetLink(nodes[i].href, res_type);
+ var newRuleLink = new kukit.RuleSheetLink(nodes[i].href, res_type);
+ results[results.length] = newRuleLink;
}
}
return results;
};
+kukit.Engine.prototype.createRuleProcessor = function(rulelink) {
+ var ruleProcessorClass = this._ruleProcessorClasses[rulelink.res_type];
+ if (ruleProcessorClass) {
+;;; var msg = "Start loading and processing " + rulelink.href;
+;;; msg = msg + " of type " + rulelink.res_type;
+;;; kukit.log(msg);
+ var ruleprocessor = new ruleProcessorClass(rulelink.href);
+ this._ruleProcessors[this._ruleProcessors.length] = ruleprocessor;
+ return ruleprocessor;
+;;; } else {
+;;; var msg = "Ignore rulesheet " + rulelink.href;
+;;; msg = msg + " of type " + rulelink.res_type;
+;;; kukit.log(msg);
+ }
+ return null;
+};
+
+
+kukit.Engine.prototype.getRules = function() {
+ var rules = new Array();
+ var ruleProcessors = this._ruleProcessors
+ for (var j=0; j<ruleProcessors.length; j++) {
+ var ruleProcessor = ruleProcessors[j];
+ for (var i=0; i<ruleProcessor.rules.length; i++) {
+ rules.push(ruleProcessor.rules[i]);
+ }
+ }
+ return rules;
+}
+
+kukit.Engine.prototype.getRuleProcessors = function() {
+ return this._ruleProcessors
+}
+
kukit.isKineticStylesheet = function(node) {
var rel = node.rel;
if (rel=="kinetic-stylesheet") {
@@ -107,19 +138,21 @@
}
// BBB to be removed after 2008-02-17
if (rel=="kukit" || rel=="k-stylesheet") {
- ;;; kukit.logWarning(node.href + ': rel "' + rel +'" is deprecated; use "kinetic-stylesheet" instead.');
+;;; var msg = node.href + ': rel "' + rel +'" is deprecated;';
+;;; msg = msg + ' use "kinetic-stylesheet" instead.';
+;;; kukit.logWarning(msg);
return true;
}
return false;
};
-kukit.Engine.prototype.setupEvents = function(in_nodes) {
+kukit.Engine.prototype.setupEvents = function(inNodes) {
if (this.setupEventsInProgress) {
// remember them
- this.setupEventsQueue = this.setupEventsQueue.concat(in_nodes);
+ this.setupEventsQueue = this.setupEventsQueue.concat(inNodes);
} else {
// do it
- this.doSetupEvents(in_nodes);
+ this.doSetupEvents(inNodes);
}
};
@@ -134,49 +167,50 @@
this.doSetupEvents(setupEventsQueue);
};
-kukit.Engine.prototype.doSetupEvents = function(in_nodes) {
+kukit.Engine.prototype.doSetupEvents = function(inNodes) {
var self = this;
- var deferred_setup_events = function() {
- self._setupEvents(in_nodes);
+ var deferredEventsSetup = function() {
+ self._setupEvents(inNodes);
};
- ;;; var targetmsg;
+;;; var targetMsg;
var found = false;
- if ( ! in_nodes) {
- ;;; targetmsg = 'document';
+ if ( ! inNodes) {
+;;; targetMsg = 'document';
found = true;
} else {
- ;;; targetmsg = 'node subtrees ';
- for (var i=0; i<in_nodes.length; i++) {
- var node = in_nodes[i];
+;;; targetMsg = 'nodes subtrees ';
+ for (var i=0; i<inNodes.length; i++) {
+ var node = inNodes[i];
if (node.nodeType == 1) {
if (! found) {
found = true;
- ;;; } else {
- ;;; targetmsg += ', ';
+;;; } else {
+;;; targetMsg += ', ';
}
- ;;; targetmsg += node.tagName.toLowerCase();
+;;; targetMsg += '[' + node.tagName.toLowerCase() + ']';
}
}
}
if (found) {
- ;;; kukit.E = 'setting up events for ' + targetmsg;
- this.bindScheduler.addPre(deferred_setup_events, kukit.E);
+ var remark = '';
+;;; remark += 'Setup of events for ' + targetMsg;
+ this.bindScheduler.addPre(deferredEventsSetup, remark);
}
};
-kukit.Engine.prototype._setupEvents = function(in_nodes) {
+kukit.Engine.prototype._setupEvents = function(inNodes) {
// Decide phase. 1=initial, 2=insertion.
var phase;
- if (typeof(in_nodes) == 'undefined') {
+ if (typeof(inNodes) == 'undefined') {
phase = 1;
} else {
phase = 2;
}
this.binderInfoRegistry.startBindingPhase();
- var rules = this.rules;
+ var rules = this.getRules();
var ruletable = new kukit.rd.RuleTable(this.loadScheduler);
for (var y=0; y < rules.length; y++) {
- rules[y].mergeForSelectedNodes(ruletable, phase, in_nodes);
+ rules[y].mergeForSelectedNodes(ruletable, phase, inNodes);
}
// bind special selectors first
if (phase == 1) {
@@ -189,63 +223,53 @@
this.binderInfoRegistry.processBindingEvents();
};
+
+
+
kukit.Engine.prototype.initializeRules = function() {
if (window.kukitRulesInitializing || window.kukitRulesInitialized) {
// Refuse to initialize a second time.
- ;;; kukit.log('Subsequent call to initializeRules is ignored !');
+;;; kukit.log('[initializeRules] is called twice.');
return;
}
+;;; kukit.log('Initializing rule sheets.');
// Succesful initialization. At the moment the engine is kept
// as a global variable, but this needs refinement in the future.
kukit.engine = this;
window.kukitRulesInitializing = true;
// load the rulesheets
var rulelinks = this.getRuleSheetLinks();
- ;;; kukit.log("Count of KSS links: " + rulelinks.length);
+;;; kukit.log("Count of KSS links: " + rulelinks.length);
for (var i=0; i<rulelinks.length; i++) {
var rulelink = rulelinks[i];
- var ruleProcessorClass = this._ruleProcessorClasses[rulelink.res_type];
- if (ruleProcessorClass) {
- ;;; kukit.log("Start loading and processing " + rulelink.href + " resource type " + rulelink.res_type);
- var ruleprocessor = new ruleProcessorClass(rulelink.href);
- ;;; var ts_start = (new Date()).valueOf();
+ var ruleprocessor = this.createRuleProcessor(rulelink);
+ if (ruleprocessor) {
+;;; var ts_start = (new Date()).valueOf();
ruleprocessor.load();
- ;;; var ts_loaded = (new Date()).valueOf();
- ;;; try {
- ruleprocessor.parse();
- ;;; } catch(e) {
- ;;; // ParsingError are logged.
- ;;; if (e.name == 'ParsingError') {
- ;;; var msg = 'Error parsing ' + rulelink.res_type + ' at ' + rulelink.href + ' : ' + e.toString();
- ;;; // Log the message
- ;;; kukit.logFatal(msg);
- ;;; // and throw it...
- ;;; throw msg;
- ;;; } else {
- ;;; throw e;
- ;;; }
- ;;; }
- ;;; var ts_end = (new Date()).valueOf();
- ;;; kukit.log("Finished loading and processing " + rulelink.href + " resource type " + rulelink.res_type + ' in ' + (ts_loaded - ts_start) + ' + ' + (ts_end - ts_loaded) + ' ms');
- this._ruleProcessors[this._ruleProcessors.length] = ruleprocessor;
- ;;; } else {
- ;;; kukit.logError("Ignoring rulesheet " + rulelink.href + ' of type ' + rulelink.res_type);
+;;; var ts_loaded = (new Date()).valueOf();
+ ruleprocessor.parse();
+;;; var ts_end = (new Date()).valueOf();
+;;; var msg = "Finished loading and processing " + rulelink.href;
+;;; msg += " resource type " + rulelink.res_type;
+;;; msg += ' in ' + (ts_loaded - ts_start) + ' + ';
+;;; msg += (ts_end - ts_loaded) + ' ms.';
+;;; kukit.log(msg);
}
}
- ;;; try {
+;;; try {
this.setupEvents();
- ;;; } catch(e) {
- ;;; // Event setup errors are logged.
- ;;; if (e.name == 'RuleMergeError' || e.name == 'EventBindError') {
- ;;; var msg = 'Error setting up events: ' + e.toString();
- ;;; // Log the message
- ;;; kukit.logFatal(msg);
- ;;; // and throw it...
- ;;; throw msg;
- ;;; } else {
- ;;; throw e;
- ;;; }
- ;;; }
+;;; } catch(e) {
+;;; // Event setup errors are logged.
+;;; if (e.name == 'RuleMergeError' || e.name == 'EventBindError') {
+;;; var msg = 'Events setup - ' + e.toString();
+;;; // Log the message
+;;; kukit.logFatal(msg);
+;;; // and throw it...
+;;; throw msg;
+;;; } else {
+;;; throw e;
+;;; }
+;;; }
window.kukitRulesInitializing = false;
window.kukitRulesInitialized = true;
};
@@ -257,7 +281,9 @@
*/
kukit.initializeRules = function() {
- ;;; kukit.logWarning('Deprecated kukit.initializeRules, use kukit.bootstrap instead!');
+;;; var msg = '[kukit.initializeRules] is deprecated,';
+;;; msg += 'use [kukit.bootstrap] instead !';
+;;; kukit.logWarning(msg);
kukit.bootstrap();
};
@@ -270,23 +296,23 @@
};
kukit.bootstrap = function() {
+;;; kukit.log('Engine instantiated.');
var engine = new kukit.Engine();
// Successful initializeRules will store the engine as kukit.engine.
// Subsequent activations will not delete the already set up engine.
// Subsequent activations may happen, if more event handlers are set up,
// and the first one will do the job, the later ones are ignored.
- ;;; kukit.log('bootstrap');
engine.initializeRules();
};
kukit.bootstrapFromDOMLoad = function() {
+;;; kukit.log('Engine instantiated in [DOMLoad].');
var engine = new kukit.Engine();
// Successful initializeRules will store the engine as kukit.engine.
// Subsequent activations will not delete the already set up engine.
// Subsequent activations may happen, if more event handlers are set up,
// and the first one will do the job, the later ones are ignored.
engine.initializedOnDOMLoad = true;
- ;;; kukit.log('bootstrap from DOMLoad');
engine.initializeRules();
};
Modified: kukit/kukit.js/trunk/kukit/oper.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/oper.js (original)
+++ kukit/kukit.js/trunk/kukit/oper.js Thu Aug 16 22:32:22 2007
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2006-2007
-* Authors: KSS Project Contributors (see docs/CREDITS.txt)
+* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -36,12 +36,12 @@
*
* node: the node in focus, to which the event triggered
*
-* parms: a dictionary that holds the parameters to the function.
-* All parameters are named ones.
+* parms: a dictionary that holds the parms to the function.
+* All parms are named ones.
*
-* eventrule: The eventrule associated by the trigger.
+* eventRule: The eventRule associated by the trigger.
*
-* binderinstance: The event binder instance that holds the event state
+* binderInstance: The event binder instance that holds the event