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

Exception "TypeError: Cannot call method 'remove' of undefined" in ionic.bundle.js #1795

Closed
manzapanza opened this issue Jul 17, 2014 · 9 comments
Assignees

Comments

@manzapanza
Copy link

Only running on a device android (Galaxy SIII mini Android 4.1.2 & ionic-bower#1.0.0-beta.9) I get hundred of errors like this in the logcat but the app continue running without problems. On iPhone Simulator or browser there are no errors.

logcat:

file:///android_asset/www/lib/ionic/js/ionic.bundle.js: Line 18897 : TypeError: Cannot call method 'remove' of undefined
    at Object.jqLite.removeClass (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:36479:24)
    at cleanup (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:31708:21)
    at closeAnimation (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:31658:17)
    at performAnimation (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:31508:11)
    at Object.addClass (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:31362:11)
    at Object.Attributes.$addClass (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:14717:20)
    at addClasses (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:27134:16)
    at Object.ngClassWatchAction [as fn] (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:27176:15)
    at Scope.$digest (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:21355:29)
    at Scope.$apply (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:21620:24)

The code 'try' to remove css classes like 'ng-animate' on html elements without css classes, for this the property el.classList is undefined at the line 36479 of ionic.bundle.js.

Maybe the simplest solution could be wrapping with a if:

if(el.classList !== undefined){
  el.classList.remove(cssClasses);
}

Thanks
Massimo

@mhartington mhartington self-assigned this Jul 22, 2014
@mhartington
Copy link
Contributor

Hmm, can you try to reproduce this with a codepen or create a similar situation to what you have?
Also, can you try with the nightly builds and see if that resolves the issue?

@manzapanza
Copy link
Author

The problem occurs only running on device Android Samsung Galaxy S3 Mini for this with nightly build as chrome there not are errors. Yesterday I tried running the basic ionic side menu app (that has some slide animations) on the device and there not was errors like these... So.. I will prepare a codepen shortly. Thanks

@mhartington
Copy link
Contributor

Hey @manzapanza, any luck with that codepen?

@manzapanza
Copy link
Author

Hi Mike, sorry for my reply delayed. I was able to isolate the problem and I discovered that is caused by an ng-repeat of path elements of a svg:
http://codepen.io/anon/pen/dEscg

@manzapanza
Copy link
Author

Hey @mhartington, do you have some news? Thanks!

@mhartington
Copy link
Contributor

Hey, sorry about that. Will look into it now. Just to make sure, can you test with beta 11or the nightly builds to make sure this wasn't already fixed

@manzapanza
Copy link
Author

Thank you for your quick reply! I already upgraded to beta 11 but the problem persist

@mhartington
Copy link
Contributor

Alright, so I was able to reproduce this. Going to assign @perrygovier to this.

@kaihenzler
Copy link

@adamdbradley
Please check the file comment in 98629d4
we are experiencing issues in IE11 because of this. It would be great to add the check for && el.classList as well

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants