Bug 2001562 Comment 1 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

There's an error in the browser toolbox: 

```
TypeError: Window.getComputedStyle: Argument 1 is not an object.
    getAnimationTimingFunction resource://devtools/server/actors/animation.js:336
    getState resource://devtools/server/actors/animation.js:376
    getCurrentState resource://devtools/server/actors/animation.js:406
    form resource://devtools/server/actors/animation.js:180
```

in https://searchfox.org/firefox-main/rev/70425199e9a5fa80aa7419fa51763013a67226e1/devtools/server/actors/animation.js#317,322-330
```js
getAnimationTimingFunction() {
...
  let pseudo = null;
  let target = this.player.effect.target;
  if (target.type) {
    // Animated element is a pseudo element.
    pseudo = target.type;
    target = target.element;
  }
  return this.window.getComputedStyle(target, pseudo).animationTimingFunction;
}
```
Here, for a `<button>` element, `target.type` does return something (e.g. "button", "submit", …), and so we re assign `target` with `target.element`, which is undefined.
Note that it's probably not returning what we want for pseudo element either: `target` is always the binding element, not the actual pseudo element anonymous node, so we wouldn't go inside the `if` block when we have pseudo elements.
There's an error in the browser toolbox: 

```
TypeError: Window.getComputedStyle: Argument 1 is not an object.
    getAnimationTimingFunction resource://devtools/server/actors/animation.js:336
    getState resource://devtools/server/actors/animation.js:376
    getCurrentState resource://devtools/server/actors/animation.js:406
    form resource://devtools/server/actors/animation.js:180
```

in https://searchfox.org/firefox-main/rev/70425199e9a5fa80aa7419fa51763013a67226e1/devtools/server/actors/animation.js#317,322-330
```js
getAnimationTimingFunction() {
...
  let pseudo = null;
  let target = this.player.effect.target;
  if (target.type) {
    // Animated element is a pseudo element.
    pseudo = target.type;
    target = target.element;
  }
  return this.window.getComputedStyle(target, pseudo).animationTimingFunction;
}
```
Here, for a `<button>` element, `target.type` does return something (e.g. "button", "submit", …), and so we re-assign `target` with `target.element`, which is undefined.
Note that it's probably not returning what we want for pseudo element either: `target` is always the binding element, not the actual pseudo element anonymous node, so we wouldn't go inside the `if` block when we have pseudo elements.

Back to Bug 2001562 Comment 1