Skip to content

The once parameter of the observe helper is useless #9257

Closed

Description

@SunsetTechuila

Description

Expected behavior: The registered listener is removed after the target element is found.

Actual behavior: The registered listener is removed after the first animation triggers anywhere on the document, regardless of the element or animation name.

The reason: The once parameter is just passed to globalThis.addEventListener('animationstart').

globalThis.addEventListener('animationstart', (event: AnimationEvent) => {
const target = event.target as ExpectedElement;
// The target can match a selector even if the animation actually happened on a ::before pseudo-element, so it needs an explicit exclusion here
if (target.classList.contains(seenMark) || !target.matches(selector)) {
return;
}
called = true;
// Removes this specific selector’s animation once it was seen
target.classList.add(seenMark);
listener(target, {signal});
}, {once, signal});
}

How to replicate the issue + URL

-

Extension version

26.4.20

Activity

  1. added
    meta
    on Apr 24, 2026
  2. SunsetTechuila commented on Apr 24, 2026

    @SunsetTechuila
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmeta

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions