[Kss-devel] Regression/BBB in client-side action names and parameters
Martin Aspeli
optilude at gmx.net
Sun Sep 30 00:57:37 CEST 2007
Hi guys,
This is just a heads-up... I went to look at the KSS interfaces again to
look up some syntax, and then realised that since I wrote the KSS
chapter in my book, you've deprecated/renamed a bunch of functions and
parameters. These are the perils of writing about a pre-released version
of Plone, of course. :)
Whilst I welcome the consistency this brings, it does mean that the book
is advising people to use the old syntax. Unfortunately, production is
now finished, so it's too late to make changes. I am finding out how to
publish errata, but at best this will be a note on some website. :-(
Furthermore, it seems that the BBB code is not working (and the error
message in Firebug is not particularly helpful).
Here's the old KSS:
#showClosedButton:click(show_button) {
evt-click-preventdefault: true;
action-client: toggleClass;
toggleClass-classname: hiddenItem;
action-client: removeClass;
removeClass-kssSelector: css("#deliverablesTable tr.closed");
removeClass-name: hiddenItem;
action-client: setStateVar;
setStateVar-varname: showHidden;
setStateVar-value: true;
}
#showClosedButton:click(hide_button) {
evt-click-preventdefault: true;
action-client: toggleClass;
toggleClass-kssSelector: htmlid(hideClosedButton);
toggleClass-classname: hiddenItem;
}
When I click the button, Firebug does this:
[Exception... "'Error: Missing mandatory parameter [value] in
[undefined].' when calling method: [nsIDOMEventListener::handleEvent]"
nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location:
"<unknown>" data: no]
initalizeTableSort(undefined)table_sorter.js (line 155)
DOMContentLoadedInit()
I have no idea why it's talking about the table sorter, but there you go.
I have to change all the parameters from name/classname to value:
#showClosedButton:click(show_button) {
evt-click-preventdefault: true;
action-client: toggleClass;
toggleClass-value: hiddenItem;
action-client: removeClass;
removeClass-kssSelector: css("#deliverablesTable tr.closed");
removeClass-value: hiddenItem;
action-client: setStateVar;
setStateVar-varname: showHidden;
setStateVar-value: true;
}
#showClosedButton:click(hide_button) {
evt-click-preventdefault: true;
action-client: toggleClass;
toggleClass-kssSelector: htmlid(hideClosedButton);
toggleClass-value: hiddenItem;
}
Now it works. I'd say this is an unintended regression that we may want
to fix.
The table in chapter 14 in my book lists the following:
Function Parameter
--------------------------------------------
addClassName name
removeClassName name
toggleClass classname
As far as I can tell, it should've been:
Function Parameter
--------------------------------------------
addClass value
removeClass value
toggleClass value
And the old ones are not working anymore.
Martin
--
Acquisition is a jealous mistress
More information about the Kss-devel
mailing list