From reebalazs at codespeak.net Mon Oct 1 16:05:28 2007
From: reebalazs at codespeak.net (reebalazs at codespeak.net)
Date: Mon, 1 Oct 2007 16:05:28 +0200 (CEST)
Subject: [KSS-checkins] r47074 - kukit/kukit.js/trunk/kukit
Message-ID: <20071001140528.A811F80F5@code0.codespeak.net>
Author: reebalazs
Date: Mon Oct 1 16:05:27 2007
New Revision: 47074
Modified:
kukit/kukit.js/trunk/kukit/commandprocessor.js
kukit/kukit.js/trunk/kukit/dom.js
Log:
base2 followup: further simplify kukit payload
since there is no namespace any more, we just check for tags
in the global namespace (which is btw kukit)
Modified: kukit/kukit.js/trunk/kukit/commandprocessor.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/commandprocessor.js (original)
+++ kukit/kukit.js/trunk/kukit/commandprocessor.js Mon Oct 1 16:05:27 2007
@@ -64,15 +64,13 @@
if (childNode.nodeType != 1)
continue;
if (childNode.localName) {
- // (here tolerate both cases)
- if (childNode.localName.toLowerCase() != "param"
- && childNode.nodeName.toLowerCase() != "kukit:param") {
+ if (childNode.localName.toLowerCase() != "param") {
throw new Error('Bad payload, expected param');
}
} else {
//IE does not know DOM2
- if (childNode.nodeName.toLowerCase() != "kukit:param") {
- throw new Error('Bad payload, expected kukit:param');
+ if (childNode.nodeName.toLowerCase() != "param") {
+ throw new Error('Bad payload, expected param (IE)');
}
}
data = childNode.getAttribute('name');
Modified: kukit/kukit.js/trunk/kukit/dom.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/dom.js (original)
+++ kukit/kukit.js/trunk/kukit/dom.js Mon Oct 1 16:05:27 2007
@@ -400,14 +400,10 @@
}
};
-dom.getNsTags = function(dom, tagName) {
- if (dom.getElementsByTagNameNS) {
- tags = dom.getElementsByTagNameNS('http://www.kukit.org/commands/1.0',
- tagName);
- } else {
- //IE does not know DOM2
- tags = dom.getElementsByTagName('kukit:' + tagName);
- }
+dom.getNsTags = function(dom_obj, tagName) {
+ // Now, all the document is in the kukit namespace,
+ // so we just access them by tagname.
+ tags = dom_obj.getElementsByTagName(tagName);
return tags;
};
From reebalazs at codespeak.net Mon Oct 1 16:06:40 2007
From: reebalazs at codespeak.net (reebalazs at codespeak.net)
Date: Mon, 1 Oct 2007 16:06:40 +0200 (CEST)
Subject: [KSS-checkins] r47075 - kukit/kss.core/trunk/kss/core/browser
Message-ID: <20071001140640.771B18095@code0.codespeak.net>
Author: reebalazs
Date: Mon Oct 1 16:06:38 2007
New Revision: 47075
Modified:
kukit/kss.core/trunk/kss/core/browser/kukitresponse.pt
Log:
base2 followup: further simplify kukit payload
All is in the same kukit namespace, no namespace quirks are needed
Modified: kukit/kss.core/trunk/kss/core/browser/kukitresponse.pt
==============================================================================
--- kukit/kss.core/trunk/kss/core/browser/kukitresponse.pt (original)
+++ kukit/kss.core/trunk/kss/core/browser/kukitresponse.pt Mon Oct 1 16:06:38 2007
@@ -1,19 +1,19 @@
-
-
-
+
-
it worked]]>
-
-
-
-
+
+
+
+
From reebalazs at codespeak.net Mon Oct 1 16:35:44 2007
From: reebalazs at codespeak.net (reebalazs at codespeak.net)
Date: Mon, 1 Oct 2007 16:35:44 +0200 (CEST)
Subject: [KSS-checkins] r47076 - in kukit/kss.core/trunk/kss/core: browser
doc tests
Message-ID: <20071001143544.1795780F8@code0.codespeak.net>
Author: reebalazs
Date: Mon Oct 1 16:35:44 2007
New Revision: 47076
Modified:
kukit/kss.core/trunk/kss/core/browser/errorresponse.pt
kukit/kss.core/trunk/kss/core/doc/tutorial_part2.rst
kukit/kss.core/trunk/kss/core/tests/kukitresponse_test.pt
kukit/kss.core/trunk/kss/core/tests/test_browserview.py
kukit/kss.core/trunk/kss/core/tests/test_kssview_core.py
Log:
base2 followup: further simplify kukit payload / fix up tests and docs
Modified: kukit/kss.core/trunk/kss/core/browser/errorresponse.pt
==============================================================================
--- kukit/kss.core/trunk/kss/core/browser/errorresponse.pt (original)
+++ kukit/kss.core/trunk/kss/core/browser/errorresponse.pt Mon Oct 1 16:35:44 2007
@@ -1,11 +1,11 @@
-
-
-
- system
- Exception: reason
-
-
-
+
+
+ system
+ Exception: reason
+
+
+
Modified: kukit/kss.core/trunk/kss/core/doc/tutorial_part2.rst
==============================================================================
--- kukit/kss.core/trunk/kss/core/doc/tutorial_part2.rst (original)
+++ kukit/kss.core/trunk/kss/core/doc/tutorial_part2.rst Mon Oct 1 16:35:44 2007
@@ -65,18 +65,17 @@
the source of the response :
::
-
-
-
-
-
+
+
+
-
We did it!
-
-
-
+ We did it!]]>
+
+
+ <
This is an XML response, where we can see how commands and parameters are
actually marshalled. When the response is interpreted by the kss engine, it
Modified: kukit/kss.core/trunk/kss/core/tests/kukitresponse_test.pt
==============================================================================
--- kukit/kss.core/trunk/kss/core/tests/kukitresponse_test.pt (original)
+++ kukit/kss.core/trunk/kss/core/tests/kukitresponse_test.pt Mon Oct 1 16:35:44 2007
@@ -1,16 +1,13 @@
-
-
-
-
-
-
it worked
-
-
-
-
-
it worked again (test)
-
-
-
-
+
+
+
+
+ it worked]]>
+
+
+ it worked again (test)]]>
+
+
+
Modified: kukit/kss.core/trunk/kss/core/tests/test_browserview.py
==============================================================================
--- kukit/kss.core/trunk/kss/core/tests/test_browserview.py (original)
+++ kukit/kss.core/trunk/kss/core/tests/test_browserview.py Mon Oct 1 16:35:44 2007
@@ -31,7 +31,7 @@
header = response.getHeader('x-ksscommands')
self.assert_('the_<>message' in header) # no < > in the message
self.assert_('\n' not in header) # no /n in the payload: would destroy the page
- self.assertEqual(header, ' \t \t\tsystem \t\tTheError: the_<>message \t ')
+ self.assertEqual(header, ' \t \t\tsystem \t\tTheError: the_<>message \t ')
def test_suite():
suites = []
Modified: kukit/kss.core/trunk/kss/core/tests/test_kssview_core.py
==============================================================================
--- kukit/kss.core/trunk/kss/core/tests/test_kssview_core.py (original)
+++ kukit/kss.core/trunk/kss/core/tests/test_kssview_core.py Mon Oct 1 16:35:44 2007
@@ -100,12 +100,12 @@
def _wrapped_commands(self, inline):
header = textwrap.dedent(u'''\
-
-
+
+
''')
footer = textwrap.dedent('''\
-
-
+
+
''')
return header + inline + footer
@@ -126,11 +126,11 @@
view.getCommandSet('core').replaceInnerHTML('div.class', 'new content')
result = view.render()
awaited = u'''\
-
-
- True
-
+
+
+ True
+
'''
self.assertCommandsEqual(result, awaited)
@@ -140,11 +140,11 @@
cs.replaceInnerHTML('div.class', 'new content')
result = view.render()
awaited = u'''\
-
-
- True
-
+
+
+ True
+
'''
self.assertCommandsEqual(result, awaited)
From kukit-checkins at codespeak.net Mon Oct 1 20:25:52 2007
From: kukit-checkins at codespeak.net (VIAGRA ® Official Site)
Date: Mon, 1 Oct 2007 20:25:52 +0200 (CEST)
Subject: [KSS-checkins] October 73% OFF
Message-ID: <20071001092732.4984.qmail@host175-2-dynamic.8-87-r.retail.telecomitalia.it>
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/kukit-checkins/attachments/20071001/132f2c54/attachment.htm
From kukit-checkins at codespeak.net Mon Oct 1 23:07:38 2007
From: kukit-checkins at codespeak.net (Viagra.com Inc)
Date: Mon, 1 Oct 2007 23:07:38 +0200 (CEST)
Subject: [KSS-checkins] October 79% OFF
Message-ID: <20071001100923.3527.qmail@host81-129-153-59.range81-129.btcentralplus.com>
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/kukit-checkins/attachments/20071001/d03a4b26/attachment.htm
From gotcha at codespeak.net Tue Oct 2 11:14:53 2007
From: gotcha at codespeak.net (gotcha at codespeak.net)
Date: Tue, 2 Oct 2007 11:14:53 +0200 (CEST)
Subject: [KSS-checkins] r47088 - kukit/kukit.js/trunk/kukit
Message-ID: <20071002091453.212A88143@code0.codespeak.net>
Author: gotcha
Date: Tue Oct 2 11:14:52 2007
New Revision: 47088
Modified:
kukit/kukit.js/trunk/kukit/kukit.js
Log:
explicit error when type='text/kss' is missing
Modified: kukit/kukit.js/trunk/kukit/kukit.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/kukit.js (original)
+++ kukit/kukit.js/trunk/kukit/kukit.js Tue Oct 2 11:14:52 2007
@@ -91,6 +91,8 @@
// Resource syntax is decided on type attribute.
if((nodes[i].type == 'text/css') || (nodes[i].type == 'text/kss')) {
res_type = 'kss';
+;;; } else {
+;;; throw kukit.err.explicitError("rel type is not text/css or text/kss");
}
var newRuleLink = new kukit.RuleSheetLink(nodes[i].href, res_type);
results[results.length] = newRuleLink;
From gotcha at codespeak.net Tue Oct 2 14:08:53 2007
From: gotcha at codespeak.net (gotcha at codespeak.net)
Date: Tue, 2 Oct 2007 14:08:53 +0200 (CEST)
Subject: [KSS-checkins] r47098 - in kukit/kss.core/trunk/kss/core: . browser
Message-ID: <20071002120853.19B998125@code0.codespeak.net>
Author: gotcha
Date: Tue Oct 2 14:08:51 2007
New Revision: 47098
Added:
kukit/kss.core/trunk/kss/core/browser/kss_javascript.pt
Modified:
kukit/kss.core/trunk/kss/core/configure.zcml
Log:
add a view that includes js simply for grok
Added: kukit/kss.core/trunk/kss/core/browser/kss_javascript.pt
==============================================================================
--- (empty file)
+++ kukit/kss.core/trunk/kss/core/browser/kss_javascript.pt Tue Oct 2 14:08:51 2007
@@ -0,0 +1,7 @@
+
+
+
+
Modified: kukit/kss.core/trunk/kss/core/configure.zcml
==============================================================================
--- kukit/kss.core/trunk/kss/core/configure.zcml (original)
+++ kukit/kss.core/trunk/kss/core/configure.zcml Tue Oct 2 14:08:51 2007
@@ -66,5 +66,12 @@
class=".browserview.KSSBrowserView"
allowed_attributes="attach_error"
/>
+
+
From gotcha at codespeak.net Tue Oct 2 14:18:18 2007
From: gotcha at codespeak.net (gotcha at codespeak.net)
Date: Tue, 2 Oct 2007 14:18:18 +0200 (CEST)
Subject: [KSS-checkins] r47099 - kukit/kss.core/trunk/kss/core/browser
Message-ID: <20071002121818.C81D2812B@code0.codespeak.net>
Author: gotcha
Date: Tue Oct 2 14:18:17 2007
New Revision: 47099
Modified:
kukit/kss.core/trunk/kss/core/browser/kss_javascript.pt
Log:
add detection of devel mode
Modified: kukit/kss.core/trunk/kss/core/browser/kss_javascript.pt
==============================================================================
--- kukit/kss.core/trunk/kss/core/browser/kss_javascript.pt (original)
+++ kukit/kss.core/trunk/kss/core/browser/kss_javascript.pt Tue Oct 2 14:18:17 2007
@@ -1,7 +1,20 @@
-
-
-
+
+
+
+
+
+
+
+
+
From gotcha at codespeak.net Tue Oct 2 14:19:15 2007
From: gotcha at codespeak.net (gotcha at codespeak.net)
Date: Tue, 2 Oct 2007 14:19:15 +0200 (CEST)
Subject: [KSS-checkins] r47100 - kukit/kukit.js/trunk/kukit
Message-ID: <20071002121915.0B6A58143@code0.codespeak.net>
Author: gotcha
Date: Tue Oct 2 14:19:15 2007
New Revision: 47100
Modified:
kukit/kukit.js/trunk/kukit/kukit.js
kukit/kukit.js/trunk/kukit/resourcedata.js
Log:
improve logging
Modified: kukit/kukit.js/trunk/kukit/kukit.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/kukit.js (original)
+++ kukit/kukit.js/trunk/kukit/kukit.js Tue Oct 2 14:19:15 2007
@@ -211,16 +211,18 @@
phase = 2;
}
this.binderInfoRegistry.startBindingPhase();
+;;; kukit.log('Selection of HTML nodes starts.');
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, inNodes);
}
- // bind special selectors first
+;;; kukit.log('Binding of document starts.');
if (phase == 1) {
this.documentRules.bindall(phase);
}
// finally bind the merged events
+;;; kukit.log('Binding of HTML nodes starts.');
ruletable.bindall(phase);
// ... and do the actual binding.
@@ -236,14 +238,14 @@
;;; kukit.log('[initializeRules] is called twice.');
return;
}
-;;; kukit.log('Initializing rule sheets.');
+;;; kukit.log('Initializing kinetic stylesheets.');
// 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 kinetic stylesheet links: " + rulelinks.length);
for (var i=0; i
Author: reebalazs
Date: Thu Oct 4 18:11:49 2007
New Revision: 47150
Modified:
kukit/kukit.js/trunk/doc/HISTORY.txt
kukit/kukit.js/trunk/kukit/kssparser.js
kukit/kukit.js/trunk/kukit/resourcedata.js
kukit/kukit.js/trunk/tests/test_kssparser.js
Log:
Merge from ree-binding-improvements branch:
Implement event binding based on the ids fetched
dynamically from the dom, by value providers.
The merge is partial, and complex because the
branches has diverged too much.
Modified: kukit/kukit.js/trunk/doc/HISTORY.txt
==============================================================================
--- kukit/kukit.js/trunk/doc/HISTORY.txt (original)
+++ kukit/kukit.js/trunk/doc/HISTORY.txt Thu Oct 4 18:11:49 2007
@@ -4,6 +4,12 @@
kukit.js - 1.4dev Unreleased
+ - ...
+
+ - Implement event binding based on the ids fetched
+ dynamically from the dom, by value providers.
+ [ree]
+
- Store some data on HTML nodes for FireKiss
[gotcha]
Modified: kukit/kukit.js/trunk/kukit/kssparser.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/kssparser.js (original)
+++ kukit/kukit.js/trunk/kukit/kssparser.js Thu Oct 4 18:11:49 2007
@@ -379,6 +379,7 @@
"(": 'new kukit.kssp.MethodArgs(this.cursor, kukit.kssp.openParent)'
});
kukit.kssp.PropValue.prototype.process = function() {
+ // Parse all tokens (including first and last)
var context = {'nextTokenIndex': 0};
this.digestTxt(context, kukit.tk.Fraction, kukit.kssp.Comment);
this.txt = '';
@@ -466,16 +467,64 @@
"\r": 'this.emitAndReturn()',
"\/\*": 'this.emitAndReturn()',
":": 'this.emitAndReturn()',
- "(": 'this.emitAndReturn(new kukit.kssp.MethodArgs(this.cursor,' +
- 'kukit.kssp.openParent))'
+ "(": '[new kukit.kssp.openParent(this.cursor), new kukit.kssp.PropValue(this.cursor)]',
+ ")": 'this.emitAndReturn(new kukit.kssp.closeParent(this.cursor))'
});
kukit.kssp.EventValue.prototype.multiword_allowed = false;
-kukit.kssp.EventValue.prototype.process =
- kukit.kssp.PropValue.prototype.process;
-kukit.kssp.EventValue.prototype.valueClass = kukit.rd.KssPseudoValue;
+kukit.kssp.EventValue.prototype.process = function() {
+ // Parse all tokens (including first and last)
+ var context = {'nextTokenIndex': 0};
+ this.digestTxt(context, kukit.tk.Fraction, kukit.kssp.Comment);
+ this.txt = '';
+ var txt = context.txt;
+ if (this.notInTokens(context, kukit.kssp.String)) {
+ // The previous txt must be all whitespace.
+ if (txt) {
+;;; kukit.E = 'Wrong value : unallowed characters [' + txt + ']';
+;;; kukit.E += ' before a string.';
+ this.emitError(kukit.E);
+ }
+ // the next one must be a string.
+ this.expectToken(context, kukit.kssp.String);
+ this.produceTxt(context.token.txt);
+ } else if (this.notInTokens(context, kukit.kssp.openParent)) {
+ this.expectToken(context, kukit.kssp.openParent);
+ this.expectToken(context, kukit.kssp.PropValue);
+ this.value = new kukit.rd.KssEventValue(txt, context.token.value);
+ this.digestTxt(context, kukit.tk.Fraction, kukit.kssp.Comment);
+ // we have to be at the end and have no text after
+ if (context.txt) {
+;;; kukit.E = 'Wrong event selector : [' + context.txt;
+;;; kukit.E += '] is not expected before the closing';
+;;; kukit.E += ' parenthesis. :() can have';
+;;; kukit.E += ' only one parameter.';
+ this.emitError(kukit.E);
+ }
+ // eat up everything before the closing parent
+ this.expectToken(context, kukit.kssp.closeParent);
+ } else {
+ // not a string or method: check if we allowed multiword.
+ if (! this.multiword_allowed && txt.indexOf(' ') != -1) {
+;;; kukit.E = 'Wrong value : [' + txt + '] cannot have spaces.';
+ this.emitError(kukit.E);
+ }
+ this.produceTxt(txt);
+ }
+ // see what's after
+ if (context.nextTokenIndex < this.result.length) {
+ this.digestTxt(context, kukit.tk.Fraction, kukit.kssp.Comment);
+ // we have to be at the end and have no text after
+ if (context.nextTokenIndex < this.result.length || context.txt) {
+;;; kukit.E = 'Excess characters after the property value';
+ this.emitError(kukit.E);
+ }
+ }
+ this.result = [];
+};
+
kukit.kssp.EventValue.prototype.produceTxt = function(txt) {
// txt parms are returned embedded
- this.value = new kukit.rd.KssPseudoValue(txt, []);
+ this.value = new kukit.rd.KssEventValue(txt, null);
};
/*
@@ -647,8 +696,10 @@
* embedded parser to parse the selector
* KSS event selector: (has spaces in it)
* selector:name(id)
-* KSS method selector: (has no spaces in it)
+* selector:name(pprov(id))
+* kss method selector: (has no spaces in it)
* document:name(id) or behaviour:name(id)
+* document:name(pprov(id)) or behaviour:name(pprov(id))
*/
kukit.kssp.KssSelector = kukit.tk.mkParser('kssselector', {
":": '[new kukit.kssp.colon(this.cursor), new ' +
@@ -713,11 +764,6 @@
;;; kukit.E += ' event name cannot have spaces.';
this.emitError(kukit.E);
}
- if (pseudotoken.value.args.length > 1) {
-;;; kukit.E = 'Wrong event selector :';
-;;; kukit.E += ':() can have only one parameter.';
- this.emitError(kukit.E);
- }
css = this.cursor.text.substring(this.startpos, commatoken.startpos);
// Decide if we have an event or a method selector.
// We have a method selector if a single word "document" or "behaviour".
@@ -732,8 +778,18 @@
}
// create the selector.
var id = null;
- if (pseudotoken.value.args.length == 1) {
- id = pseudotoken.value.args[0];
+ var ppid = null;
+ if (pseudotoken.value.arg) {
+ // We have something in the parentheses after the event name.
+ if (pseudotoken.value.arg.isMethod) {
+ // we have a param provider here. Just store.
+ ppid = pseudotoken.value.arg;
+ // Check its syntax too.
+ ppid.check(kukit.pprovidersGlobalRegistry);
+ } else {
+ // just an id. Express in txt.
+ id = pseudotoken.value.arg.txt;
+ }
}
var name = pseudotoken.value.methodName;
var splitname = name.split('-');
@@ -750,7 +806,7 @@
// Protect the error for better logging
;;; try {
this.kssSelector = new kukit.rd.KssSelector(isEvent, css, name,
- namespace, id);
+ namespace, id, ppid);
;;; } catch(e) {
;;; if (e.name == 'KssSelectorError') {
;;; // Log the message
@@ -791,6 +847,7 @@
// Store event rules in the common list
for (var i=0; i
-* Balazs Ree
+* Copyright (c) 2005-2007
+* Authors: KSS Project Contributors (see docs/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
@@ -230,7 +228,7 @@
};
this.testEventValue = function() {
- // Parsing prop values in pseudo (no methods allowed)
+ // Parsing event value (now methods allowed too)
var txt= "b";
var cursor = new kukit.tk.Cursor(txt);
@@ -268,7 +266,8 @@
parser = new kukit.kssp.EventValue(cursor, null, true);
this.assertEquals(parser.finished, true);
this.assertEquals(parser.value.methodName, 'click');
- this.assertListEquals(parser.value.args, ['x']);
+ this.assertEquals(parser.value.arg.isMethod, false);
+ this.assertEquals(parser.value.arg.txt, 'x');
// more then 1 args not ok (but we check it only from kss selector)
//txt= "drag(x, y)";
@@ -282,6 +281,28 @@
};
+ this.testEventValueWithValueProvider = function() {
+ // methods ok
+ txt= "click(kssAttr(x))";
+ src = new kukit.tk.Cursor(txt);
+ parser = new kukit.kssp.EventValue(src, null, true);
+ this.assertEquals(parser.finished, true);
+ this.assertEquals(parser.value.methodName, 'click');
+ this.assertEquals(parser.value.arg.isMethod, true);
+ this.assertEquals(parser.value.arg.methodName, 'kssAttr');
+ this.assertListEquals(parser.value.arg.args, ['x']);
+ };
+
+ this.testEventValueWithValueProviderRejectsAccessValues = function() {
+ // no more values in the method
+ txt= "click(kssAttr(x), aaa)";
+ src = new kukit.tk.Cursor(txt);
+ this.assertParsingError(kukit.kssp.EventValue, src, null, true,
+ 'Wrong event selector : [,] is not expected before the closing parenthesis. :() can have only one parameter.', 000);
+
+ // XXX add more failing cases, maybe?
+ };
+
this.testMethodArgs = function() {
// Parsing method args
var txt= "(a, b)";
@@ -419,6 +440,9 @@
+"#calendar-previous a:click {\n"
+" action-server : kukitGetPreviousMonth /* place comment here*/;\n"
+" kukitGetPreviousMonth-member: formVar(edit, kssAttr(foo));\n"
+ +'}\n'
+ +"#button-one:click(kssAttr(widannoy)) {\n"
+ +" action-client: alert;\n"
+"}\n";
var cursor = new kukit.tk.Cursor(txt);
@@ -427,13 +451,13 @@
var parser = new kukit.kssp.Document(cursor, null, true);
this.assertEquals(parser.finished, true);
- this.assertEquals(parser.eventRules.length, 13);
+ this.assertEquals(parser.eventRules.length, 14);
var rule;
var action;
// rule 0
// #calendar-previous a:click {
- // kss-action : kukitresponse/kukitGetPreviousMonth;
+ // action-server : kukitresponse/kukitGetPreviousMonth;
// }
rule = parser.eventRules[0];
this.assertDictEquals(rule.parms, {});
@@ -451,7 +475,7 @@
// div#update-area:timeout {
// evt-timeout-delay: 2000;
// effect: fade;
- // kss-action: getCurrentTime;
+ // action-server: getCurrentTime;
// }
rule = parser.eventRules[1];
this.assertDictEquals(rule.parms, {'delay': '2000'});
@@ -469,7 +493,7 @@
// rule 2
// #calendar-previous a:click {
- // kss-action : 'kukitresponse/kukitGetPreviousMonth' /* place comment here*/;
+ // action-server : 'kukitresponse/kukitGetPreviousMonth' /* place comment here*/;
// }
rule = parser.eventRules[2];
this.assertDictEquals(rule.parms, {});
@@ -485,7 +509,7 @@
// rule 3
// #calendar-previous a:click {
- // kss-action : 'kukitresponse/kukitGetPreviousMonth' /* place comment here*/;
+ // action-server : 'kukitresponse/kukitGetPreviousMonth' /* place comment here*/;
// member: formVar(edit, 'f_member');
// }
rule = parser.eventRules[3];
@@ -504,7 +528,7 @@
// rule 4
// #calendar-previous a:dnd-drag(shelve) {
- // kss-action : whatever
+ // action-server : whatever
// }
rule = parser.eventRules[4];
this.assertDictEquals(rule.parms, {});
@@ -522,7 +546,7 @@
// rule 5
//#button-one:dnd-drag(annoyMe) {
- // kss-action: clickedButton;
+ // action-server: clickedButton;
// id: nodeAttr(id);
//}
rule = parser.eventRules[5];
@@ -542,7 +566,7 @@
// rule 6
// document:dnd-drag(annoyMe) {
- // kss-action: alert;
+ // action-client: alert;
// message: "You are an idiot! Ha ha ha. (But just keep on trying...)";
//}
rule = parser.eventRules[6];
@@ -562,8 +586,7 @@
// rule 7
// document:dnd-drag(annoyMe) {
- // annoy#annoy-me {
- // kss-action: alert;
+ // action-client: alert;
// message: "You are an idiot! Ha ha ha. (But just keep on trying...)";
//}
rule = parser.eventRules[7];
@@ -631,7 +654,6 @@
// setStyle-name: backgroundColor;
// setStyle-value: #FFa0a0;
//}
-
rule = parser.eventRules[10];
this.assertDictEquals(rule.parms, {});
this.assertEquals(rule.kssSelector.isEventSelector, true);
@@ -649,14 +671,13 @@
'kssSelector': new kukit.rd.KssMethodValue('htmlid', ['button_2'])
});
- // rule 12
+ // rule 11
//#button_3:click {
// action-client: setStyle;
// setStyle-kssSelector: "#button_4";
// setStyle-name: backgroundColor;
// setStyle-value: #FFa0a0;
//}\n";
-
rule = parser.eventRules[11];
this.assertDictEquals(rule.parms, {});
this.assertEquals(rule.kssSelector.isEventSelector, true);
@@ -674,7 +695,7 @@
'kssSelector': new kukit.rd.KssTextValue('#button_4')
});
- // rule 13
+ // rule 12
// #calendar-previous a:click {
// kss-action : 'kukitresponse/kukitGetPreviousMonth' /* place comment here*/;
// member: formVar(edit, kssAttr(foo));
@@ -695,9 +716,31 @@
var kssAttr = formVar.args[1];
this.assertEquals(kssAttr.methodName, 'kssAttr');
this.assertListEquals(kssAttr.args, ['foo']);
+
+ // rule 13
+ // #button-one:click(kssAttr(widannoy)) {\n"
+ // action-client: alert;
+ //}
+ rule = parser.eventRules[13];
+ this.assertDictEquals(rule.parms, {});
+ this.assertEquals(rule.kssSelector.css, '#button-one');
+ this.assertEquals(rule.kssSelector.isEventSelector, true);
+ this.assertEquals(rule.kssSelector.name, 'click');
+ this.assertEquals(rule.kssSelector.namespace, null);
+ this.assertEquals(rule.kssSelector.id, null);
+ this.assertEquals(rule.kssSelector.ppid.methodName, 'kssAttr');
+ this.assertListEquals(rule.kssSelector.ppid.args, ['widannoy']);
+ action = rule.actions.content['alert'];
+ this.assertEquals(action.type, 'C');
+ this.assertEquals(action.name, 'alert');
+ this.assertEquals(action.error, null);
+ this.assertKssParmEquals(action.parms, {
+ });
+
};
this.testActionErrorParameters = function() {
+
var txt= ""
+"/* a long\n"
+"** comment\n"
@@ -850,7 +893,7 @@
txt= "a:click('hello', bello)";
cursor = new kukit.tk.Cursor(txt);
this.assertParsingError(kukit.kssp.KssSelector, cursor, null, true,
- 'Wrong event selector ::() can have only one parameter.', 22);
+ 'Wrong event selector : [,] is not expected before the closing parenthesis. :() can have only one parameter.', 22);
// zero params: not std css but tolerated
txt= "a:click()";
@@ -904,22 +947,23 @@
'Wrong event selector : missing event qualifier : or :().', 20);
// Spaces in the end
- txt= " a:lang(hu, uh) b:click ";
+ // txt= " a:lang(hu, uh) b:click "; // XXX not supported
+ txt= " a:lang(hu-uh) b:click ";
cursor = new kukit.tk.Cursor(txt);
parser = new kukit.kssp.KssSelector(cursor, null, true);
this.assertEquals(parser.finished, true);
this.assertEquals(parser.kssSelector.isEventSelector, true);
- this.assertEquals(parser.kssSelector.css, " a:lang(hu, uh) b");
+ this.assertEquals(parser.kssSelector.css, " a:lang(hu-uh) b");
this.assertEquals(parser.kssSelector.name, 'click');
this.assertEquals(parser.kssSelector.namespace, null);
// Comment in the end
- txt= " a:lang(hu, uh) b:click/*comment here*/";
+ txt= " a:lang(hu-uh) b:click/*comment here*/";
cursor = new kukit.tk.Cursor(txt);
parser = new kukit.kssp.KssSelector(cursor, null, true);
this.assertEquals(parser.finished, true);
this.assertEquals(parser.kssSelector.isEventSelector, true);
- this.assertEquals(parser.kssSelector.css, " a:lang(hu, uh) b");
+ this.assertEquals(parser.kssSelector.css, " a:lang(hu-uh) b");
this.assertEquals(parser.kssSelector.name, 'click');
this.assertEquals(parser.kssSelector.namespace, null);
@@ -1382,6 +1426,43 @@
'Wrong value for evt-[-] [dnd-drag] : - should exist in the event of the selectors.', 6);
}
+ this.testValueProvidersInEventIdentification = function() {
+ // Param providers within the event identification
+
+ var txt= "a:click(kssAttr(hello))";
+ var src = new kukit.tk.Cursor(txt);
+ var parser = new kukit.kssp.KssSelector(src, null, true);
+ this.assertEquals(parser.finished, true);
+ this.assertEquals(parser.kssSelector.isEventSelector, true);
+ this.assertEquals(parser.kssSelector.css, 'a');
+ this.assertEquals(parser.kssSelector.name, 'click');
+ this.assertEquals(parser.kssSelector.namespace, null);
+ this.assertEquals(parser.kssSelector.id, null);
+ this.assertEquals(parser.kssSelector.ppid.methodName, 'kssAttr');
+ this.assertListEquals(parser.kssSelector.ppid.args, ['hello']);
+ };
+
+ this.testValueProvidersInEventIdentification2 = function() {
+ var txt= "a:click(kssAttr(hello, true ))";
+ var src = new kukit.tk.Cursor(txt);
+ var parser = new kukit.kssp.KssSelector(src, null, true);
+ this.assertEquals(parser.finished, true);
+ this.assertEquals(parser.kssSelector.isEventSelector, true);
+ this.assertEquals(parser.kssSelector.css, 'a');
+ this.assertEquals(parser.kssSelector.name, 'click');
+ this.assertEquals(parser.kssSelector.namespace, null);
+ this.assertEquals(parser.kssSelector.id, null);
+ this.assertEquals(parser.kssSelector.ppid.methodName, 'kssAttr');
+ this.assertListEquals(parser.kssSelector.ppid.args, ['hello', 'true']);
+ };
+
+ this.testValueProvidersInEventIdentificationRejectsMoreParameters = function() {
+ var txt= "a:drag(kssAttr(hello), xxx)";
+ var src = new kukit.tk.Cursor(txt);
+ this.assertParsingError(kukit.kssp.KssSelector, src, null, true,
+ 'Wrong event selector : [,] is not expected before the closing parenthesis. :() can have only one parameter.', 000);
+ };
+
};
kukit.KssParserSelectorsTestCase.prototype = new kukit.KssParserTestCaseBase;
From reebalazs at codespeak.net Thu Oct 4 18:13:42 2007
From: reebalazs at codespeak.net (reebalazs at codespeak.net)
Date: Thu, 4 Oct 2007 18:13:42 +0200 (CEST)
Subject: [KSS-checkins] r47151 - in kukit/kss.core/trunk: docs
kss/core/plugins/core kss/core/plugins/core/demo_for_binderids
kss/core/plugins/core/demo_for_binderids/selenium_tests
Message-ID: <20071004161342.C06AB8199@code0.codespeak.net>
Author: reebalazs
Date: Thu Oct 4 18:13:40 2007
New Revision: 47151
Added:
kukit/kss.core/trunk/kss/core/plugins/core/demo_for_binderids/
kukit/kss.core/trunk/kss/core/plugins/core/demo_for_binderids/README
kukit/kss.core/trunk/kss/core/plugins/core/demo_for_binderids/__init__.py
kukit/kss.core/trunk/kss/core/plugins/core/demo_for_binderids/binderids.kss
kukit/kss.core/trunk/kss/core/plugins/core/demo_for_binderids/binderids.pt
kukit/kss.core/trunk/kss/core/plugins/core/demo_for_binderids/configure.zcml
kukit/kss.core/trunk/kss/core/plugins/core/demo_for_binderids/selenium_tests/
kukit/kss.core/trunk/kss/core/plugins/core/demo_for_binderids/selenium_tests/README.txt
kukit/kss.core/trunk/kss/core/plugins/core/demo_for_binderids/zopeconfig.py
Modified:
kukit/kss.core/trunk/docs/HISTORY.txt
kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml
Log:
Merge from ree-binding-improvements branch:
Implement event binding based on the ids fetched
dynamically from the dom, by value providers.
I created the demos for this in a temporary directory
under the core plugin. This will be moved to the directory
that contains the demos of all plugins.
Modified: kukit/kss.core/trunk/docs/HISTORY.txt
==============================================================================
--- kukit/kss.core/trunk/docs/HISTORY.txt (original)
+++ kukit/kss.core/trunk/docs/HISTORY.txt Thu Oct 4 18:13:40 2007
@@ -6,12 +6,17 @@
- ...
+ - Implement event binding based on the ids fetched
+ dynamically from the dom, by value providers.
+ [ree]
+
- Changed kukit payload to encode HTML content of CDATA.
This was necessary because us a supposed bug in FF, that
prevented us to use base2 (xpath selection did not work
on inserted elements, due to namespace issues.)
Get rid of forceToDom, make sure all plugins accept html
parameters as strings.
+ [ree]
kss.core - 1.2 Released 2007-08-17
Modified: kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml
==============================================================================
--- kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml (original)
+++ kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml Thu Oct 4 18:13:40 2007
@@ -5,6 +5,9 @@
xmlns:zcml="http://namespaces.zope.org/zcml"
>
+
+
+
+
+
Binder ids
+
+
We bind the events on these two buttons with different binder ids.
+ Events bound to different binders will not merge.
+ (Note that this is not the typical usage
+ if event ids, only a simple check that it really works.
+ )If you click the buttons, you need to
+ receive alerts per each event bound.
+
+
+
+
+
+
+
+
+
+
+
+
+
First we bind an event with id "manual" to each buttons.
+ We also bind event manual2 to the second button. Then
+ we bind events that acquire their id from kssattr to the second and
+ third buttons. So we will have the following events bound:
+