Documentation for <<dom-to>>

In EventCatcher DIY, I use a technique I’ve seen used elsewhere but not found documented.

\define my-actions()
<$action-setfield $field="log" $value=<<dom-text>> />
\end

<$eventcatcher selector="button" $click=<<my-actions>> >
  <button text="alpha">alpha</button>
   <!- ... ->
</$eventcatcher>

Here I set text on the buttons, and in my action use the variable <<dom-text>>. I saw this with <<dom-to>> and tested with <<dom-foo>> and it seems to work fine with an arbitrary attribute.

It seems pretty clear what it does, taking attributes of the event target and exposing them as variables in the dom- namespace. But I don’t know where it applies. Is it only in the EventCatcher, or are there many places that do this? I haven’t been able to find the documentation on this either on the main site or the dev one. Am I simply using the wrong search terms, am I overlooking it in the results, or is this simply not documented?

Hi @Scott_Sauyet, the translation of DOM attributes into variables in this manner is specific to the $eventcatcher widget and is documented there.

At one point I explored a similar technique to allow attributes prefixes with dom- specified on any widget that creates a DOM node to be assigned as attributes on that DOM node. However, doing so consistently is problematic since many widgets already support some attributes.

Hi @Scott_Sauyet,

I don’t know if it’s what you were looking for, but in the EventCatcherWidget Documentation we can read the variables are available to the actions:

image

A similar mechanism is available in the MessageCatcherWidget, but not in the LinkCatcherWidget (according to documentation at least).

Thanks for your clear explanation of EventCatcher widget usage by the way!

Have fun,

Fred

@saqimtiaz, @tw-FRed:
I must be blind. I read that page tiddler three times and still managed to miss it. Thank you both!