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.
Use the event name in methods like addEventListener()
, or set an event handler property.
addEventListener("DOMActivate", (event) => { })
onDOMActivate = (event) => { }
Event type 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 JavaScript function from a DOMActivate event</desc>
<!-- JavaScript to change the radius -->
<script>
<![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="text/javascript" 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 Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3