What should KeyframeEffect.pseudoElement do if it is set in an invalid or unsupported value? I can see a few possibilities here.
-
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.
-
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.
-
Leave pseudoElement unchanged. Again, can cause false positives.
-
Set pseudoElement to the text given and do not animate.
-
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.
What should KeyframeEffect.pseudoElement do if it is set in an invalid or unsupported value? I can see a few possibilities here.
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.
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.
Leave pseudoElement unchanged. Again, can cause false positives.
Set pseudoElement to the text given and do not animate.
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.