Opinion poll!
You have a <button>, it makes a <foo> open. What would be the best declarative attribute for the button to control the foo?
Opinion poll!
You have a <button>, it makes a <foo> open. What would be the best declarative attribute for the button to control the foo?
<button target="foo" action="open" on="click">@Lukew @keithamus I just thought as well about specifying multiple invocations. I think it is legal to use {attribute}:{index}={value} in XHTML? e.g.
<button
invoketarget:1="foo"
invokeaction:1="open"
invoketarget:2="foo-tooltip"
invokeaction:2="open"
invokeevent:2="focus mouseover"
invoketarget:3="foo-tooltip"
invokeaction:3="close"
invokeevent:3="focusout mouseout"
>
Here I'm specifying the button opens foo on default invocation (click or keypress), but it can also open/close a related tooltip when the button is focused or hovered (freewheelingly introducing a new attribute invokeevent to specify which event triggers the action).
@Lukew @keithamus the only other thing I could suggest for multiple different invocations is by separating by delimiter within attribute values:
<button invoketarget="foo; foo-tooltip" invokeaction="open; focus mouseover:open, focusout mouseout:close">
In this the suggestion is that the delimiter ; splits the target/action into array where index groups target/action. An additional delimiter of comma separates actions, and actions could be prefixed by the desired event(s) (separated by whitespace if there are multiple) with a : and the action:
{
0: {
invoketarget: "foo",
invokeaction: "open",
},
1: {
invoketarget: "foo-tooltip",
invokeaction: [
0: {
event: "focus mouseover",
action: "open",
},
1: {
event: "focusout mouseout",
action: "close",
}
]
}
}
Maybe that's overcomplicated too...