I agree, the schema is wrong.
On 12 Jan 2006, at 20:45, Jim Grandy wrote:
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
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev