Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'cancel' of null #39

Closed
blairwilcox opened this issue Sep 1, 2015 · 4 comments
Closed

Cannot read property 'cancel' of null #39

blairwilcox opened this issue Sep 1, 2015 · 4 comments

Comments

@blairwilcox
Copy link

I'm trying to use the polyfill on Codepen and I keep running into this error. The full message is as follows:

Uncaught TypeError: Cannot read property 'cancel' of null
b.Animation @ pen.js:1772
window.onload @ pen.js:2134

This happens when using both the 2.1.2 version of the minified file, as well as the 2.1.1 version. A link to the pen can be found here

restlessdesign added a commit to restlessdesign/web-animations-js that referenced this issue Sep 1, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
`_rebuildUnderlyingAnimation()` will handle the call to cancel the current animation (if one exists) as well as setting it to `null`.
@shans
Copy link
Contributor

shans commented Sep 2, 2015

  var anim = new Animation(
    blah, [{
      opacity: 0
    }, {
      opacity: 1
    }],
    1000);

This code is incorrect - Animation doesn't take these parameters, KeyframeEffect does. (The specification renamed some terms recently which led to this confusion.)

You probably just want to use Element.animate, btw:

anim = blah.animate([{opacity: 0}, {opacity: 1}], 1000);

@shans shans closed this as completed Sep 2, 2015
@blairwilcox
Copy link
Author

Thanks shans. I was trying to follow the format that was used on the Polymer project page. This is a top search result and I get linked to it often. Is this incorrect, or has the spec changed since then?

@shans
Copy link
Contributor

shans commented Sep 7, 2015

Yup, the spec changed. Looks like the Polymer documentation's updated now too, due to your bug. Thanks for following this up so diligently!

@blairwilcox
Copy link
Author

No problem! The Web Animations spec seems really interesting and I'm just glad to have accurate documentation for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants