Skip to content

[web-animations] Error handling in KeyframeEffect.pseudoElement #4586

@george-steel

Description

@george-steel

What should KeyframeEffect.pseudoElement do if it is set in an invalid or unsupported value? I can see a few possibilities here.

  1. Throw an exception. This can easily break backwards compatibility as the set of pseudo-elements is not currently fixed. Running an animation with a new pseudoelement on an old browser can crash the whole script. I think it makes sense for inputs that don't start with "::" though.

  2. Set pseudoElement to null. This fails without crashing but has the disadvantage of causing animations to happen on the wrong element in the case of an unsupported pseudo-element.

  3. Leave pseudoElement unchanged. Again, can cause false positives.

  4. Set pseudoElement to the text given and do not animate.

  5. Set pseudoElement to s sentinel value (such as ::unknown) which has no effect. Allows for error detection without the possibility of crashes.

My personal preference is for option 5.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions