Truly independent web browser
LibWeb: Keep SVGAnimationElement's onend and onrepeat handlers apart
Jelle Raaijmakers7c1cee29453c
diff --git a/Libraries/LibWeb/SVG/SVGAnimationElement.cpp b/Libraries/LibWeb/SVG/SVGAnimationElement.cppindex ffb9ec93d9a..29a85a6f1ec 100644--- a/Libraries/LibWeb/SVG/SVGAnimationElement.cpp+++ b/Libraries/LibWeb/SVG/SVGAnimationElement.cpp@@ -37,13 +37,13 @@ void SVGAnimationElement::set_onend(GC::Ptr<WebIDL::CallbackType> value)// https://svgwg.org/specs/animations/#__svg__SVGAnimationElement__onendGC::Ptr<WebIDL::CallbackType> SVGAnimationElement::onend(){- return event_handler_attribute(HTML::EventNames::error);+ return event_handler_attribute(HTML::EventNames::end);}// https://svgwg.org/specs/animations/#__svg__SVGAnimationElement__onrepeatvoid SVGAnimationElement::set_onrepeat(GC::Ptr<WebIDL::CallbackType> value){- set_event_handler_attribute(HTML::EventNames::end, value);+ set_event_handler_attribute(HTML::EventNames::repeat, value);}// https://svgwg.org/specs/animations/#__svg__SVGAnimationElement__onrepeatdiff --git a/Tests/LibWeb/Text/expected/SVG/animation-element-event-handlers.txt b/Tests/LibWeb/Text/expected/SVG/animation-element-event-handlers.txtnew file mode 100644index 00000000000..af3ca506cf7--- /dev/null+++ b/Tests/LibWeb/Text/expected/SVG/animation-element-event-handlers.txt@@ -0,0 +1,6 @@+onbegin returns its handler: true+onend returns its handler: true+onrepeat returns its handler: true+onbegin called for begin+onend called for end+onrepeat called for repeatdiff --git a/Tests/LibWeb/Text/input/SVG/animation-element-event-handlers.html b/Tests/LibWeb/Text/input/SVG/animation-element-event-handlers.htmlnew file mode 100644index 00000000000..9b07500da75--- /dev/null+++ b/Tests/LibWeb/Text/input/SVG/animation-element-event-handlers.html@@ -0,0 +1,19 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<script>+ test(() => {+ const set = document.createElementNS("http://www.w3.org/2000/svg", "set");+ const calls = [];+ const handlers = {};+ for (const name of ["onbegin", "onend", "onrepeat"]) {+ handlers[name] = event => calls.push(`${name} called for ${event.type}`);+ set[name] = handlers[name];+ }+ for (const name of ["onbegin", "onend", "onrepeat"])+ println(`${name} returns its handler: ${set[name] === handlers[name]}`);+ for (const type of ["begin", "beginEvent", "end", "endEvent", "repeat", "repeatEvent"])+ set.dispatchEvent(new Event(type));+ for (const call of calls)+ println(call);+ });+</script>