[Laszlo-dev] schema for <handler>
Jim Grandy
jgrandy at laszlosystems.com
Thu Jan 12 17:45:01 PST 2006
I'm converting the base components to use <event> and <handler>, and
ran into something I don't think is quite right.
The proposal (http://wiki.openlaszlo.org/Event_and_handler_tags)
suggests that <handler> should have two forms:
> <handler name="eventName" [reference="..."] [args="..."]>
> ...
> </handler>
and
> <handler name="eventName" [reference="..."] method="methodName" />
But the schema entry looks like this:
> handler =
> element handler {
> ( nameAttribute |
> ( nameAttribute? &
> ## The name of the method that this handler will call
> attribute method {string} &
> ## If this attribute is present, it is a JavaScript expression
> ## that evaluates to an object. The code in this method executes
> ## when this object sends the event named by the @a{event}
> ## attribute. This attribute may be present only if
> ## the @a{event} attribute is present too.
> [a:defaultValue="this"]
> attribute reference {reference}?)) &
> ## The parameter names of this method. The value of this
> attribute
> ## is a comma-separated list of JavaScript identifiers.
> [a:defaultValue=""
> lza:modifiers="final"]
> attribute args {string}? &
> text
> }
>
I read this as allowing
<handler name="eventName" [args="..."]> ... </handler>
or
<handler [name="eventName"] method="methodName" [reference="..."]
[args="..."]> ... </handler>
Whether text is allowed or not (it shouldn't if @method is given) is
one problem. Another is that I can't write
<handler name="eventName" reference="..." args="..."> ... </handler>
The workaround for the second is (I think) to split the handler
definition into a handler and a method, but I shouldn't have to do this.
Third, the comment says about @method that "this attribute may be
present only if the @a{event} attribute is present too," but there's
no @event attribute in handler. Does this mean to say @name instead
of @event?
If everyone agrees, I'll propose a change to the schema to fix both
of these problems. I don't see a unit test file; Henry, did you write
one when you did the initial implementation?
jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openlaszlo.org/pipermail/laszlo-dev/attachments/20060112/e52c5f3e/attachment.html
More information about the Laszlo-dev
mailing list