olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.96k stars 548 forks source link

Safari (iOS) "TypeError" #45

Closed CptSchmock closed 11 years ago

CptSchmock commented 11 years ago

With lunr.js 0.4.1, Safari (iOS) shows the following JavaScript error in line 765:

"TypeError: Result of expression '(function () {this._idfCache = {}..."

As the index is not generated, another JavaScript error is shown when my JavaScript is executed:

"TypeError: Result of Expression 'index'[undefined] is not an object".

olivernn commented 11 years ago

What version of Mobile Safari are you using?

That line uses Function.prototype.bind which I think isn't/wasn't available on some older versions of Safari and Mobile Safari.

lunr.js assumes a modern browser that supports Function.prototype.bind, if you need it to work in older browsers that do not support this you need to use a shim such as augment.js or es5-shim.

If you are still having problems then please put together a simple example of the problem, you can use this fiddle as the basis, that way I can take a closer look at the problem.

CptSchmock commented 11 years ago

Thank you for your quick answer. The version of iOS was 4.3.1. I updated it to version 5.1.1. Now the first error is not shown anymore. Instead, Safari always shows the JavaScript error "TypeError 'undefined' is not a function". I'll try it with augment.js and inform you about the results.

CptSchmock commented 11 years ago

OK, it's working with augment.js. I'll close this issue. Thank you again.