Author: gotcha
Date: Thu Dec 18 13:27:08 2008
New Revision: 60564
Added:
kukit/kukit.js/branch/gotcha-simplify-service-layer/3rd_party/base2-dom-fp-20080312.js
- copied unchanged from r60551,
kukit/kukit.js/trunk/3rd_party/base2-dom-fp-20080312.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/3rd_party/base2-dom-fp.js
- copied unchanged from r60551,
kukit/kukit.js/trunk/3rd_party/base2-dom-fp.js
Modified:
kukit/kukit.js/branch/gotcha-simplify-service-layer/3rd_party/cssQuery-compat.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/3rd_party/sarissa.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/doc/HISTORY.txt
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/actionreg.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/dom.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/errors.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/forms.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/kssparser.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/oper.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/plugin.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/serveraction.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/tokenizer.js
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/utils.js
Log:
trunk changes : merge -r 53859:60016
http://codespeak.net/svn/kukit/kukit.js/trunk
Modified:
kukit/kukit.js/branch/gotcha-simplify-service-layer/3rd_party/cssQuery-compat.js
==============================================================================
---
kukit/kukit.js/branch/gotcha-simplify-service-layer/3rd_party/cssQuery-compat.js
(original)
+++
kukit/kukit.js/branch/gotcha-simplify-service-layer/3rd_party/cssQuery-compat.js
Thu Dec 18 13:27:08 2008
@@ -5,24 +5,49 @@
* want to use cssQuery.
*
* When both cssQuery and base2 are present, this code does nothing.
- * When cssQuery is missing, this code defines a compatibility cssQuery
- * function that actually reuses base2 for querying.
+ * When cssQuery is missing at the time this code is loaded,
+ * it defines a compatibility cssQuery function that actually reuses
+ * base2 for querying.
*
*/
+// Check that cssQuery is missing originally.
+// If it is present, do not redefine it.
if (typeof(window.cssQuery) == 'undefined') {
// Define the compatibility layer.
- window.cssQuery = function(selector, element) {
- if (typeof(element) == 'undefined') {
- // if parameter is not given, we need to use document.
- element = document;
+ window.cssQuery = function _cssQueryStub(selector, element) {
+ // This stub checks which base2 api to use.
+ // It only runs once and also returns the result.
+ //
+ // Base2 legacy version: matchAll has to be used
+ // Base2 recent version: querySelectorAll has to be used
+ var _USE_BASE2_LEGACY = (typeof(base2.DOM.Document.querySelectorAll)
== 'undefined');
+ var f;
+ if (! _USE_BASE2_LEGACY) {
+ f = function(selector, element) {
+ return base2.DOM.Document.querySelectorAll(element, selector);
+ };
+ } else {
+ f = function(selector, element) {
+ return base2.DOM.Document.matchAll(element, selector);
+ };
}
- var results = base2.DOM.Document.matchAll(element, selector);
- var nodes = [];
- for(var i = 0; i < results.length; i++) {
- nodes.push(results.item(i));
- }
- return nodes;
+ // redefine the function with its final version
+ window.cssQuery = function cssQuery(selector, element) {
+ if (typeof(element) == 'undefined') {
+ // if parameter is not given, we need to use document.
+ element = document;
+ }
+ var results = f(selector, element);
+ var nodes = [];
+ for(var i = 0; i < results.length; i++) {
+ nodes.push(results.item(i));
+ }
+ return nodes;
+ };
+ // since we are in the stub, we need to use
+ // the newly redefined function
+ return window.cssQuery(selector, element);
};
};
Modified:
kukit/kukit.js/branch/gotcha-simplify-service-layer/3rd_party/sarissa.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/3rd_party/sarissa.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/3rd_party/sarissa.js
Thu Dec 18 13:27:08 2008
@@ -10,13 +10,8 @@
* ====================================================================
* Licence
* ====================================================================
- * Sarissa is free software distributed under the GNU GPL version 2 (see <a
href="gpl.txt">gpl.txt</a>) or higher,
- * GNU LGPL version 2.1 (see <a href="lgpl.txt">lgpl.txt</a>) or higher and
Apache Software License 2.0 or higher
- * (see <a href="asl.txt">asl.txt</a>). This means you can choose one of the
three and use that if you like. If
- * you make modifications under the ASL, i would appreciate it if you
submitted those.
- * In case your copy of Sarissa does not include the license texts, you may
find
- * them online in various formats at <a
href="http://www.gnu.org">http://www.gnu.org</a> and
- * <a href="http://www.apache.org">http://www.apache.org</a>.
+ * Sarissa is free software distributed under the GNU GPL version 2
+ * Other licenses are also available, see http://dev.abiss.gr/sarissa/
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE
Modified: kukit/kukit.js/branch/gotcha-simplify-service-layer/doc/HISTORY.txt
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/doc/HISTORY.txt
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/doc/HISTORY.txt Thu Dec
18 13:27:08 2008
@@ -6,7 +6,12 @@
- ...
- - Add global registries.
+MISSING, PLEASE MERGE! - Add improved demos
+ (insertions in tbody is not included : that demo is
+ still broken in IE6)
+ [gotcha]
+
+ - Add a general registry for interfaces.
Add service layers.
@@ -43,14 +48,47 @@
two places and considered as two broken selectors.
[ree]
-
- - refactor the value provider registry to use
+ - Refactor the value provider registry to use
a single registry in place of 3.
This will enable to define value
providers that recieve non-string parameters
like a node selection.
[ree]
+ - Fix or improve calculateAbsoluteURL to handle absolute
+ and relative urls correctly, as well as get rid of the
+ double slash (//) issue.
+ It also satisfies the tests kss_url_param and
+ kss_url_param_multiprop, that now work as intended,
+ with previous workaround removed.
+ [ree]
+
+ - Replaced license header of third-party sarissa.js
+ to workaround the license detection of ohloh.
+ sarissa.js is redistributed under GNU GPL v2
+ as previously.
+ [ree]
+
+ - Fix cssQuery-compat.js to use newest base2 api.
+ [ree]
+
+ - Fix a typo that caused an exception instead of
+ logging an error message, this happened when
+ an action was regitered twice with the same name.
+ [ree]
+
+kukit.js - 1.4 Released 2008-04-21
+
+ - Updated base2-dom-fp.js with newest version.
+ [ree]
+
+ - fix setKssAttribute action and command
+ (closes bug 8048 from plone.org)
+ [gotcha]
+
+ - fix action-cancel
+ [gotcha]
+
- disabled input values should not be submitted with the form
[gotcha]
@@ -58,8 +96,6 @@
This fixes breakage on FireFox 3.
[ree]
-kukit.js - 1.4dev Unreleased
-
- Remove previously deprecated form() and
currentForm() value providers from normal
action parameters (remark: they should
@@ -83,11 +119,6 @@
- Fix multiple selection form fields marshalling on Safari
(fixes #22 in kssproject) and on IE.
-
- - Fix multiple selection form fields
- marshalling on Safari
- (fixes #22 in kssproject)
- and on IE.
[ree]
- Fix error fallback handling
Modified: kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/actionreg.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/actionreg.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/actionreg.js
Thu Dec 18 13:27:08 2008
@@ -34,7 +34,7 @@
;;; if (typeof(func) == 'undefined') {
;;; kukit.e = '[func] argument is mandatory when registering an action';
;;; kukit.e += ' [ActionRegistry.register].';
-;;; throw new Error(kukit.E);
+;;; throw new Error(kukit.e);
;;; }
var actions = kukit.registrars.actions;
actions.getItemFactory(name).register({actionFunc: func});
Modified: kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/dom.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/dom.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/dom.js Thu Dec
18 13:27:08 2008
@@ -269,7 +269,7 @@
dom.setKssAttribute = function(node, attrname, value) {
// Sets a given kss attribute on the namespace
var fullName = _kssAttrNamespace + ':' + attrname;
- dom.setAttribute(node, fullName);
+ dom.setAttribute(node, fullName, value);
};
/*
@@ -358,7 +358,7 @@
function(node, attrname, recurseParents, getter) {
return dom.locateMarkup(node,
recurseParents, getter, attrname).value;
-}
+};
/*
* From http://xkr.us/articles/dom/iframe-document/
Modified: kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/errors.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/errors.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/errors.js Thu Dec
18 13:27:08 2008
@@ -224,7 +224,7 @@
;;; // this error protects and annotates all errors that
;;; // happen during KssRuleProcessor.parse.
;;; err.kssParsingError = function(e, url){
-;;; var kw = {url: url}
+;;; var kw = {url: url};
;;; var message = 'Error parsing KSS at ' + url;
;;; return setErrorInfo(e, 'KssParsingError', message, kw);
;;; };
Modified: kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/forms.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/forms.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/forms.js Thu Dec
18 13:27:08 2008
@@ -132,7 +132,7 @@
this.initialize = function(target) {
this.target = target;
-}
+};
this.queryForm = function() {
// Find the form that contains the target node.
Modified: kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/kssparser.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/kssparser.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/kssparser.js
Thu Dec 18 13:27:08 2008
@@ -324,7 +324,7 @@
;;; }
// set it
var action = this.actions.getOrCreateAction(value.txt, valuesByReturnType);
- if (actionType == 'X' && action.type == null) {
+ if (actionType == 'X' && action.type != null) {
// action-cancel, and the action existed already in the same block:
// we delete it straight ahead
this.actions.deleteAction(value.txt);
@@ -512,7 +512,7 @@
this.process = function() {
// For multivalue only
- this.values = []
+ this.values = [];
// Parse all tokens (including first and last)
var context = {'nextTokenIndex': 0};
this.txt = '';
@@ -944,10 +944,10 @@
return new kssp.MethodArgs(this.cursor, kssp.openParent)
},
"'": function() {
- return new kssp.StringInSelector(this.cursor, kssp.quote)
+ return new kssp.StringInSelector(this.cursor, kssp.quote);
},
'"': function() {
- return new kssp.String2InSelector(this.cursor, kssp.dquote)
+ return new kssp.String2InSelector(this.cursor, kssp.dquote);
},
",": _mkReturnToken(kssp.comma),
"{": _emitAndReturn,
@@ -1115,7 +1115,7 @@
kssp.KssSelector = kukit.tk.mkParser('kssselector', {
":": function() {
return [new kssp.colon(this.cursor),
- new kssp.EventValue(this.cursor)]
+ new kssp.EventValue(this.cursor)];
},
"{": _emitAndReturn,
"\/\*": _returnComment
Modified: kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/oper.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/oper.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/oper.js Thu Dec
18 13:27:08 2008
@@ -254,7 +254,7 @@
if (this.eventRule) {
// if it has actions, the answer is yes
if (this.eventRule.actions.hasActions())
- return true
+ return true;
// if we have a default action, we will return true in any case
// because we may want to call it.
// The reason for this check is, that a default action is also
Modified: kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/plugin.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/plugin.js Thu Dec
18 13:27:08 2008
@@ -1013,11 +1013,11 @@
}
}
if (parms.allnodes) {
- binder.__continueEvent_allNodes__(parms.name,
+ binder.continueEventAllNodes(parms.name,
actionParameters);
} else {
// execution happens on the orignode
- binder.__continueEvent__(parms.name, oper.orignode,
+ binder.continueEvent(parms.name, oper.orignode,
actionParameters);
}
});
Modified:
kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/serveraction.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/serveraction.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/serveraction.js
Thu Dec 18 13:27:08 2008
@@ -63,24 +63,40 @@
this.notifyServer();
};
+/*
+ * calculateAbsoluteURL
+ *
+ * Makes absolute site url
+ * - if starts with http:// https:// : no change
+ * - if starts with /: interprets absolute from domain
+ * - otherwise: relative to current context
+ */
this.calculateAbsoluteURL = function(url) {
- //
- // If the url is an absolute path, it is used
- //
- // If the url is not an absolute path, it is put at the end of the context
- // url.
- //
- // example: url='@theview/getName',
- // context='http://your.site.com/portal/folder/object'
- //
- // result='http://your.site.com/portal/folder/object/@@theview/getName'
- //
- if (url.match(RegExp('/^https?:\/\//'))) {
+ // XXX packer breaks on following regexp constant,
+ // so it must be quoted
+ if (url.match(RegExp("/^https?:\/\//"))) {
+ // absolute already
return url;
- } else {
- var result = kukit.engine.baseUrl + url;
- return result;
}
+ var absoluteMatch = url.match(RegExp(/^(\/)(.*)/));
+ var path = kukit.engine.baseUrl;
+ if (absoluteMatch) {
+ // relative to domain
+ var base = path.match(RegExp(/^(.*:\/\/[^\/]*)(\/?)/))[1];
+ // base is like: http://foo.bar without trailing /
+ url = base + url;
+ return url;
+ }
+ // final case: relative to current url
+ // (paranoia: add an / to the path *only* if it is
+ // *not* there)
+ // XXX packer breaks on following
+ // regexp constant, so it must be quoted
+ if (! path.match(RegExp("/$"))) {
+ path += '/';
+ }
+ url = path + url;
+ return url;
};
// Backparameters can be used on command execution.
@@ -135,8 +151,8 @@
};
this.notifyServer_done = function(domDoc) {
-;;; var msg = 'Request readyState = ' + domDoc.readyState + '.';
-;;; kukit.logDebug(msg);
+//;;; var msg = 'Request readyState = ' + domDoc.readyState + '.';
+//;;; kukit.logDebug(msg);
if (domDoc.readyState == 4) {
// notify the queue that we are done
var success = this.oper.queueItem.receivedResult();
@@ -288,7 +304,8 @@
;;; }
throw kukit.err.responseParsingError(kukit.E);
}
- }
+ };
+
if (dom == null) {
// this should not happen
;;; kukit.E = 'Neither xml nor html payload.';
Modified: kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/tokenizer.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/tokenizer.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/tokenizer.js
Thu Dec 18 13:27:08 2008
@@ -73,7 +73,7 @@
};
this.nextStep = function() {
- var table = this.table
+ var table = this.table;
var cursor = this.cursor;
// Search for symbol according to table.
var best_pos = cursor.text.length;
@@ -245,7 +245,7 @@
tk.mkParser = function(symbol, table, _class) {
// Poor man's subclassing.
f = function(cursor, tokenClass, isTopLevelParser) {
- this.table = table
+ this.table = table;
this.cursor = cursor;
this.startpos = cursor.pos;
this.finished = false;
Modified: kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/utils.js
==============================================================================
--- kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/utils.js
(original)
+++ kukit/kukit.js/branch/gotcha-simplify-service-layer/kukit/utils.js Thu Dec
18 13:27:08 2008
@@ -54,7 +54,7 @@
try {
kukit.HAVE_SAFARI = navigator.vendor &&
navigator.vendor.indexOf('Apple') != -1;
- kukit.HAVE_IE = eval("_SARISSA_IS_IE");
+ kukit.HAVE_IE = eval("_SARISSA_IS_IE");
} catch (e) {}
;;; // Activation of extra logging panel: if necessary
@@ -82,7 +82,7 @@
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,
c.length);
}
return null;
-}
+};
// a null function that is used for logging
kukit._null = function() {};
@@ -162,7 +162,7 @@
;;; kukit.dom.createCookie(kukit._COOKIE_LOGLEVEL, level);
;;; // re-establish the log handlers, based on this cookie setting
;;; kukit._logger.updateLogLevel();
-}
+};
// We want a way of knowing if Firebug is available :
// it is very convenient to log a node in Firebug;
@@ -192,7 +192,7 @@
;;; this.logWarning = console.warn;
;;; this.logError = console.error;
;;; this.logFatal = console.error;
-;;; }
+;;; };
;;; }
;;; // check whether the logging stuff of MochiKit is available
@@ -211,7 +211,7 @@
;;; this.logWarning = MochiKit.Logging.logWarning;
;;; this.logError = MochiKit.Logging.logError;
;;; this.logFatal = MochiKit.Logging.logFatal;
-;;; }
+;;; };
;;; // make convenience url
;;; // javascript:kukit.showLog();
;;; // instead of the need to say
@@ -236,7 +236,7 @@
;;; this.logWarning = function(str) { console.log('WARNING: '+str); };
;;; this.logError = function(str) { console.log('ERROR: '+str); };
;;; this.logFatal = function(str) { console.log('FATAL: '+str); };
-;;; }
+;;; };
;;; }
// Initialize the logger with the solution we've just detected
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins