Object # has no method 'getBoundClientRect'

I’m using Ionic 1.0.0-beta.9 in Cordova, and when running on Android, we’re getting the following exception when re-sizing occurs:

Uncaught TypeError: Object # has no method 'getBoundClientRect' file:///android_asset/www/lib/ionic/js/ionic.bundle.js 6911 49

Which points to this line of code:

// determine width of each slide
width = container.offsetWidth || container.getBoundClientRect().width;

I think this is simply a typo; I changed the line to this to solve the problem:

// determine width of each slide
width = container.offsetWidth || container.getBoundingClientRect().width;

(notice bound -> bounding).

It was easiest to reproduce when using the native dialogs plugin (org.apache.cordova.dialogs) and launching a confirm dialog. Once the user tapped inside of the input field, the Android keyboard would slide up and the same exception would occur 5-6 times.

The only reason we noticed this exception is because we have an exception logging framework that shows a toast message and logs the exception details when one occurs. It doesn’t seem to break anything, other than causing a lot of exceptions.

Again, this was only a problem on our Android devices. For whatever reason, we didn’t have the same problem on iOS.

1 Like