Re: Default for dispatch/@targetid

Here are a few other options:

1. Use a special marker. For handlers, we support, in our implementation,
the following extensions:

- [#all][1]
- [#observer][2]
- [#preceding-sibling][3]

We could imagine something like:

  <action ev:event="my-timer">
    <send/>
    <dispatch name="my-timer" delay="20000" targetid="#observer"/>
  </action>

The meaning would be "the observer of the current event handler".

2. Have more context information in events, in which case you can write:

  <action ev:event="my-timer">
    <send/>
    <dispatch name="my-timer" delay="20000" targetid="{event('targetid')}"/>
  </action>

This is what we have in our implementation, with an extension:

    event('xxf:targetid')

These options only reduce the need for an explicit id, but do not reduce
markup on `<dispatch>`.

Speaking of events, allowing importing the `ev:` prefix/namespace makes
sense in XForms+XHTML I think. Our implementation supports that as well:

  <action event="my-timer">

But that is a separate question.

-Erik

[1]
https://doc.orbeon.com/xforms/events-extensions-other.html#catching-all-events
[2]
https://doc.orbeon.com/xforms/events-extensions-other.html#specifying-the-current-observer-as-target-restriction
[3]
https://doc.orbeon.com/xforms/events-extensions-other.html#observing-the-preceding-sibling-element


On Wed, May 10, 2017 at 3:33 AM, Steven Pemberton <steven.pemberton@cwi.nl>
wrote:

> Just a thought about reducing the need for explicit id attributes.
>
> Is there an argument to be had for allowing the default target of dispatch
> to be the parent?
>
> The use-case I had in mind was this, current method:
>
> <model id="model">
>   ...
>   <dispatch ev:event="xforms-ready" name="my-timer"
>             delay="20000" targetid="model"/>
>
>   <action ev:event="my-timer">
>     <send/>
>     <dispatch name="my-timer" delay="20000"
>               targetid="model"/>
>   </action>
> </model>
>
> which could then be expressed
>
> <model>
>   ...
>   <dispatch ev:event="xforms-ready" name="my-timer" delay="20000"/>
>
>   <action ev:event="my-timer">
>     <send/>
>     <dispatch name="my-timer" delay="20000"/>
>   </action>
> </model>
>
> Since nearly all events bubble, this would have the same effect, and
> relieve the necessity of having to specify an id on the model. You still
> have the option of explicitly using an id.
>
> Steven
>
>

Received on Tuesday, 16 May 2017 17:33:03 UTC