Living Standard — Last Updated 22 October 2023
This section is non-normative.
Buttons
are
used
to
control
elements
on
the
page,
such
as
controlling
forms.
They
can
be
used
to
control
other
elements
on
the
page
using
the
invoketarget
attribute.
HTML
elements
may
have
an
associated
invocation
action
algorithm
which
defines
how
the
element
reacts
to
being
invoked.
Invocations
can
vary
based
on
the
invokeaction
attribute.
The
invokeaction
attribute
is
a
freeform
string
that
acts
as
a
hint
to
invocation
action
algorithm
s
to
perform
some
specific
action
such
as
showing
or
hiding.
It
is
not
enumerated,
to
allow
for
userland
implementations
of
an
invocation.
Buttons may have the following content attributes:
invoketarget
invokeaction
If
specified,
the
invoketarget
attribute
value
must
be
the
ID
of
an
element
in
the
same
tree
as
the
button
with
the
invoketarget
attribute.
interface mixin InvokeElement {
[CEReactions] attribute Element? invokeTargetElement;
[CEReactions] attribute DOMString invokeAction;
};
The
invokeTargetElement
IDL
attribute
must
reflect
the
invoketarget
attribute.
The
invokeAction
IDL
attribute
must
reflect
the
invokeaction
attribute.
To
run
the
invoke
target
attribute
activation
behavior
given
a
Node
node
:
Let
invokee
be
invoketarget
-associated
element
.
If invokee is null, then return.
Let
action
be
node
's
invokeaction
attribute
If
action
is
null
or
empty,
then
let
action
be
the
string
"
auto
".
Let
notCancelled
be
the
result
of
firing
an
event
named
invoke
at
invokee
with
its
action
set
to
action
,
its
invoker
set
to
node
,
and
its
cancelable
attribute
initialized
to
true.
If notCancelled is true:
If
action
is
an
ASCII
case-insensitive
match
for
"
togglePopover
"
or
"
auto
",
then:
If invokee 's popover visibility state is , then set shouldShowPopover to true.
Otherwise set shouldHidePopover to true.
if
action
is
an
ASCII
case-insensitive
match
for
"
hidePopover
",
and
invokee
's
popover
visibility
state
is
showing
,
then
set
shouldHidePopover
to
true.
if
action
is
an
ASCII
case-insensitive
match
for
"
showPopover
",
and
invokee
's
popover
visibility
state
is
,
then
set
shouldShowPopover
to
true.
If shouldShowPopover is true, then:
Assert : shouldHidePopover is false.
Run the show popover given invokee , false, and node .
Otherwise, if shouldHidePopover is true and the result of running check popover validity given popover , false, false, and null is true, then:
Assert : shouldShowPopover is false.
Run the hide popover algorithm given invokee , true, true, and false.
Otherwise, if invokee has an associated invocation action algorithm then run the invokee's invocation action algorithm given action .
HTML elements may have an associated invocation action algorithm which defines how the element reacts to being invoked.