Skip to content

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

@manzapanza

Description

@manzapanza

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions