[Laszlo-dev] schema for <handler>

Henry Minsky henry.minsky at gmail.com
Thu Jan 12 18:23:34 PST 2006


I'm terrible at writing .rnc schemas...

I'll send you the test cases I was using as soon as I can find them.


On 1/12/06, Jim Grandy <jgrandy at laszlosystems.com> 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
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>
>
>


--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openlaszlo.org/pipermail/laszlo-dev/attachments/20060112/5b0fbc1f/attachment.html


More information about the Laszlo-dev mailing list