Author: gotcha
Date: Mon Dec 24 18:04:12 2007
New Revision: 50067
Modified:
kukit/kukit.js/branch/finish-closures/kukit/TODO.txt
kukit/kukit.js/branch/finish-closures/kukit/selectorreg.js
Log:
unindent and initialize
Modified: kukit/kukit.js/branch/finish-closures/kukit/TODO.txt
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/TODO.txt (original)
+++ kukit/kukit.js/branch/finish-closures/kukit/TODO.txt Mon Dec 24
18:04:12 2007
@@ -3,5 +3,4 @@
eventreg.js
kssparser.js
providerreg.js
-selectorreg.js
tokenizer.js
Modified: kukit/kukit.js/branch/finish-closures/kukit/selectorreg.js
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/selectorreg.js (original)
+++ kukit/kukit.js/branch/finish-closures/kukit/selectorreg.js Mon Dec 24
18:04:12 2007
@@ -25,22 +25,29 @@
sr.pproviderSelRegistry = new kukit.pr.ValueProviderRegistry();
-// this will provide an arbitrary selector, and is designed to
-// be used with the makeAnyPP factory function.
+/*
+* class _AnyPP
+*
+* This will provide an arbitrary selector, and is designed to
+* be used with the makeAnyPP factory function.
+*
+*/
var _AnyPP = function() {
- this.check = function(args) {
- // check does not need to be used here actually.
-;;; if (args.length != 1) {
-;;; throw new Error('internal error, xxxselector() needs 1 argument');
-;;; }
- };
- this.eval = function(args, node, defaultParameters) {
- var f = kukit.selectorTypesGlobalRegistry.get(this.selector_type);
- // We don't have orignode if we evaluate from here, consequently
- // the orignode parameter cannot be used from selectors. We pass
- // node just to be sure...
- return f(args[0], node, defaultParameters, node);
- };
+
+this.check = function(args) {
+ // check does not need to be used here actually.
+;;; if (args.length != 1) {
+;;; throw new Error('internal error, xxxselector() needs 1 argument');
+;;; }
+};
+this.eval = function(args, node, defaultParameters) {
+ var f = kukit.selectorTypesGlobalRegistry.get(this.selector_type);
+ // We don't have orignode if we evaluate from here, consequently
+ // the orignode parameter cannot be used from selectors. We pass
+ // node just to be sure...
+ return f(args[0], node, defaultParameters, node);
+};
+
};
sr.pproviderSelRegistry.register('', _AnyPP);
@@ -52,23 +59,30 @@
return pp;
};
-// this can be used to pass a node programmatically
+/*
+* class _AnyPP
+*
+* This can be used to pass a node programmatically
+*
+*/
var _PassnodePP = function() {
- this.check = function(args) {
-;;; if (args.length != 1) {
-;;; throw new Error('passnode selector method needs 1 argument');
-;;; }
- };
- this.eval = function(args, node, defaultParameters) {
- var value = defaultParameters[args[0]];
- if (typeof(value) == 'undefined') {
- // notfound arguments will get null
-;;; kukit.E = 'Nonexistent default parm "'+ key +'"';
- throw new Error(kukit.E);
- }
- nodes = [value];
- return nodes;
- };
+
+this.check = function(args) {
+;;; if (args.length != 1) {
+;;; throw new Error('passnode selector method needs 1 argument');
+;;; }
+};
+this.eval = function(args, node, defaultParameters) {
+ var value = defaultParameters[args[0]];
+ if (typeof(value) == 'undefined') {
+ // notfound arguments will get null
+;;; kukit.E = 'Nonexistent default parm "'+ key +'"';
+ throw new Error(kukit.E);
+ }
+ nodes = [value];
+ return nodes;
+};
+
};
sr.pproviderSelRegistry.register('passnode', _PassnodePP);
@@ -84,34 +98,39 @@
*
*/
var _SelectorTypeRegistry = function () {
+
+this.initialize = function() {
this.mapping = {};
- this.register = function(name, func) {
- if (typeof(func) == 'undefined') {
- throw new Error('Func is mandatory.');
- }
-;;; if (this.mapping[name]) {
-;;; // Do not allow redefinition
-;;; kukit.logError('Error : redefinition attempt of selector ' + name);
-;;; return;
-;;; }
- this.mapping[name] = func;
- // Also register the selector param provider
- var pp = sr.makeAnyPP(name);
- sr.pproviderSelRegistry.register(name, pp);
- };
-
- this.get = function(name) {
- if (! name) {
- // if name is null or undefined or '',
- // we use the default type.
- name = this.defaultSelectorType;
- }
- var result = this.mapping[name];
-;;; if (typeof(result) == 'undefined') {
-;;; throw new Error('Unknown selector type "' + name + '"');
-;;; }
- return result;
- };
+};
+
+this.register = function(name, func) {
+ if (typeof(func) == 'undefined') {
+ throw new Error('Func is mandatory.');
+ }
+;;; if (this.mapping[name]) {
+;;; // Do not allow redefinition
+;;; kukit.logError('Error : redefinition attempt of selector ' + name);
+;;; return;
+;;; }
+ this.mapping[name] = func;
+ // Also register the selector param provider
+ var pp = sr.makeAnyPP(name);
+ sr.pproviderSelRegistry.register(name, pp);
+};
+
+this.get = function(name) {
+ if (! name) {
+ // if name is null or undefined or '',
+ // we use the default type.
+ name = this.defaultSelectorType;
+ }
+ var result = this.mapping[name];
+;;; if (typeof(result) == 'undefined') {
+;;; throw new Error('Unknown selector type "' + name + '"');
+;;; }
+ return result;
+};
+this.initialize.apply(this, arguments);
};
_SelectorTypeRegistry.prototype.defaultSelectorType = 'css';
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins