commit 4dd232594c61988c90cafa8a23003b65522f93f6
parent 288c0e9d31dd31a5c1fe5167dd3bda14f63766ba
Author: Fredrik Söderquist <fs@opera.com>
Date: Mon, 27 Oct 2025 10:08:11 +0000
Bug 1996331 [wpt PR 55644] - Don't throw away conditions when removing a timed element from document, a=testonly
Automatic update from web-platform-tests
Don't throw away conditions when removing a timed element from document
When a timed element was removed from the document, we would call
ClearConditions() which disconnects (stops observing) any conditions and
then clears the condition vector. This means that if the timed element
was added to the document again there would be no conditions to
reconnect, and sync- or event-bases would be lost.
Only disconnect conditions instead to leave them to potentially be
reconnected at a later time.
Fixed: 435311134
Change-Id: Iaf550a1458f282e7980bf3f52638219720353008
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7079311
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/main@{#1535107}
--
wpt-commits: e6c59d0b6c396f81279becfc5fae7f58c25245a3
wpt-pr: 55644
Diffstat:
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/svg/animations/scripted/eventbase-after-removal.html b/testing/web-platform/tests/svg/animations/scripted/eventbase-after-removal.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<title>Event base 'begin' after removal from the document</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<svg>
+ <rect height="100" width="100">
+ <animate begin="click" dur="1s" attributeName="width" from="50" to="100"/>
+ </rect>
+</svg>
+<script>
+ async_test(t => {
+ const svg = document.querySelector('svg');
+ document.body.removeChild(svg);
+ document.body.appendChild(svg);
+
+ document.querySelector('animate').onbegin = t.step_func_done();
+
+ // Defensively, wait for 'load' and a paint before attempting to trigger a
+ // 'click'.
+ window.onload = t.step_func(() => {
+ requestAnimationFrame(t.step_func(() => {
+ requestAnimationFrame(t.step_func(() => {
+ const rect = svg.firstElementChild;
+ rect.dispatchEvent(new MouseEvent('click'));
+ }));
+ }));
+ });
+ });
+</script>
diff --git a/testing/web-platform/tests/svg/animations/scripted/syncbase-after-removal.html b/testing/web-platform/tests/svg/animations/scripted/syncbase-after-removal.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<title>Sync base 'begin' after removal from the document</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<svg>
+ <rect height="100" width="100">
+ <animate id="anim" begin="0s;anim.end" dur="50ms"
+ attributeName="width" from="50" to="100"/>
+ </rect>
+</svg>
+<script>
+ promise_test(t => {
+ const animation = document.getElementById('anim');
+ const watcher = new EventWatcher(t, animation, 'beginEvent');
+ // Wait for three 'beginEvent' events.
+ const p = watcher.wait_for(['beginEvent', 'beginEvent', 'beginEvent']);
+ const svg = document.querySelector('svg');
+ document.body.removeChild(svg);
+ document.body.appendChild(svg);
+ return p;
+ });
+</script>