Shopify/batman — Issue #189: TypeError: 'undefined' is not a function (evaluating 'this.startObservingItems.bind(this)')
Author: goyox86
Created: 2011-10-19 17:46:12+00:00
State: open

We are having this error while trying to test our first ever Batman.js App in Safari.

This error is preventing the application of running at all.

The Application environment is simple.The application resides in a pristine Rails 3.1.1, which is serving the assets, as you may know we are using the new default asset pipeline of Rails.

The problem occurs when trying to test the Batman.js application in Safari Version 5.1.1 (7534.51.22) (Which I think is the latest Safari official distribution). I've noticed the error using the Safari development tools.

When I take a look at our "application.js" file you can look at this here: https://gist.github.com/1298979

According to Safari the error is in line: 10782.

I've tested the application in Mozilla Firefox Version 7.0.1 and it runs as expected.
Also tested the application in Google Chrome Version 14.0.835.202 and it also runs as expected.

I've traced the error in order to test if I can reach the Batman.js CoffeeScript line/portion of code where the error could reside and I've found in our current "batman.js.coffee" file: https://gist.github.com/1299023 that the error can be around the line 993.

Is important to mention that the fact that the application can run successfully in Chrome but not in Safari (at least the version I highlight here) go me suspicious just because both of them use WebKit. So I decided to give a test to the application with a nightly build of WebKit.

I installed WebKit (yesterday's build) Version 5.1.1 (7534.51.22, r97664) and the Batman.js application ran successfully. The problem here is that I don't know if the error resides in the build of WebKit used by latest Safari , or in the Batman.js implementation itself.

I think this is crucial, because is not useful to have that wonderful framework, without being capable or running in Safari and IOS enabled devices. Ive tested in IOS simulator Version 4.3 (238.2) and the same Safari error occurs.

I'm running all of this in Mac OS X 10.7.2.

Here is the output of my "uname -a":

Darwin Goyox86s-MacBook.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64

Cheers,
Jose