Skip to content

TypeError: 'undefined' is not a function #209

Closed
NiklasHansen opened this Issue Feb 10, 2014 · 7 comments

4 participants

@NiklasHansen

Hi,

When using list.js in conjunction with Safari or PhantomJS, I experience the following issue:

list.js:433
TypeError: 'undefined' is not a function (evaluating 'el[bind](prefix + type, fn, capture || false)')

Both Safari and PhantomJS use JavaScriptCore for javascript engine. I don't experience any problems in Chrome (with the V8 engine).

@javve
Owner
javve commented Feb 10, 2014

Which Safari version and OS?
Can I see some code?

I know that there are some problems with PhantomJS that I haven't had time to investigate yet :S

@mbp
mbp commented Feb 10, 2014

I have the same problem with Safari 5.1.7 on Windows.

Here's a link to reproduce: https://rawgithub.com/mbp/059a0c438463fce97d41/raw/clicktest.html

@NiklasHansen

Windows 7 Professional SP1 64-bit.
Safari 5.1.7

and @mbp just provided some code to look at :-)

@luanmuniz luanmuniz referenced this issue Feb 15, 2014
Closed

Broken tests #210

@woto
woto commented Mar 10, 2014

Hi, i found the difference between Chrome and PhantomJS.

module.exports = function toArray(collection) {
  ...
  //console.log(typeof collection === 'function');
  // in phantomjs it returns true, in chrome not.
  if (typeof collection === 'function') return [collection]

Simple replacing to

  if (typeof collection === 'function') return collection

fix the problem, don't know is this right for other browsers.

Tested with this simple script. I hope it's will be usefull

console.log('Loading a web page');

var page = require('webpage').create();

var system = require('system');

page.onConsoleMessage = function(msg) {
    system.stderr.writeLine('console: ' + msg);
};

var url = 'http://localhost:3002';
page.open(url, function (status) {
  //Page is loaded!
  phantom.exit();
});
@mbp
mbp commented Mar 14, 2014

I can confirm this fix works. Is it possible to get into list.js master, @javve?

@javve
Owner
javve commented Mar 14, 2014

Thanks a lot for the fix suggestion and the confirmation!
I'll look into it asap.

@javve
Owner
javve commented Mar 21, 2014

This should now be fixed as of version 1.1.1 ☀️

@javve javve closed this Mar 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.