Element: DOMActivate event
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
The DOMActivate
event is fired at an element when it becomes active, such as when it is clicked on using the mouse or a keypress is used to navigate to it.
Syntax
Use the event name in methods like addEventListener()
, or set an event handler property.
addEventListener("DOMActivate", (event) => {});
onDOMActivate = (event) => {};
Event type
A MouseEvent
. Inherits from UIEvent
and Event
.
Event properties
[...]
Examples
<svg
xmlns="http://www.w3.org/2000/svg"
version="1.2"
baseProfile="tiny"
xmlns:ev="http://www.w3.org/2001/xml-events"
width="6cm"
height="5cm"
viewBox="0 0 600 500">
<desc>Example: invoke an ECMAScript function from a DOMActivate event</desc>
<!-- ECMAScript to change the radius -->
<script type="application/ecmascript">
<![CDATA[ function change(evt) { const circle = evt.target; const
currentRadius = circle.getFloatTrait("r"); if (currentRadius === 100) {
circle.setFloatTrait("r", currentRadius * 2); } else {
circle.setFloatTrait("r", currentRadius * 0.5); } } ]]>
</script>
<!-- Act on each DOMActivate event -->
<circle cx="300" cy="225" r="100" fill="red">
<handler type="application/ecmascript" ev:event="DOMActivate">
change(evt);
</handler>
</circle>
<text
x="300"
y="480"
font-family="Verdana"
font-size="35"
text-anchor="middle">
Activate the circle to change its size
</text>
</svg>
Specifications
Specification |
---|
UI Events # event-type-DOMActivate |
Browser compatibility
BCD tables only load in the browser