0

So today I've ran into a weird issue, the example will explain everything:

JSFIDDLE

function animate(arg) {
  console.log(arg);
}
<button onclick="animate('foo')">
Run
</button>
Dellirium
  • 1,362
  • 16
  • 30

1 Answers1

2

According to MDN, the Element.animate() is a built-in experimental function:

The Element interface's animate() method is a shortcut method which creates a new Animation, applies it to the element, then plays the animation. It returns the created Animation object instance.

In your case, it becomes window.animate(), which takes up a different function.

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
  • 1
    Okay thanks for explaining, but that is seriously not how it should be interpreted by the goddamn browser. I mean I understand why but.... cmon... – Dellirium Apr 21 '17 at 10:39