Skip to content

fix(docs): ignore child animation events in Promise helper - #1938

Open
nemo-crypto wants to merge 1 commit into
animate-css:mainfrom
nemo-crypto:fix/docs-animation-child-events
Open

nemo-crypto wants to merge 1 commit into
animate-css:mainfrom
nemo-crypto:fix/docs-animation-child-events

Conversation

@nemo-crypto

Copy link
Copy Markdown

The documented animateCSS() Promise helper listens with {once: true} and handles every bubbling animationend. When a nested child animation finishes before its parent, the helper removes the parent's animation classes and resolves its Promise early. It also stops the child's event from reaching other ancestors.

Ignore events whose target is not the selected node, and explicitly remove the listener only after the node's own animation finishes. This preserves cleanup and the existing return value without consuming the listener on a child event. Update both the Markdown source and generated documentation.

Validation: tests/javascript-helper.js extracts and executes the actual documented snippet in Chromium, Firefox and WebKit. It verifies child-event propagation, no premature cleanup/resolution, parent completion, and listener removal. The test fails against the original snippet (resolved=true and parent classes removed after the child's event) and passes with the fix. These are deterministic DOM AnimationEvent tests, not physical-device tests. Also ran npm run docs:pages and git diff --check.

To run the optional regression: install @playwright/test without saving dependencies, install its three browsers, then run node tests/javascript-helper.js.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants