Skip to content

IE 7/8/9 error #8

Closed
inkbiegel opened this Issue Jul 31, 2012 · 5 comments

4 participants

@inkbiegel

I implemented your plugin in a responsive project I'm working on, staying very close to the way it is implemented on the demo page. It works perfectly in FF and Chrome.

However in IE9 (and IE7/IE8 mode in IE9) I get the following error:

Error: Object doesn't support property or method 'addListener'

Thrown on the following line:

return this._window_matchmedia(mediaQuery).addListener(function(mql){return _this._update_states(_this.states[mediaQuery],mql.matches)})};

Any idea why this might be? I really want to use this in my project..

Thanks in advance

@jkintscher
Harvest member

Is this still happening? Someone else saw a similar issue that was in fact related to a third party framework/script. What were you using Harvey with?

I'm so sorry for this super late answer!

@ghost
ghost commented Nov 9, 2012

For me your demo page is giving me this error in IE9 with IE8/IE8 Standards modes

SCRIPT65535: Unexpected call to method or property access.
harvey.js, line 159 character 7

I added Harvey to my project and getting this error in IE8 mode

SCRIPT5007: Unable to get value of the property 'firstChild': object is null or undefined
harvey.js, line 377 character 7

It's a Drupal 7 site, latest version of jQuery, some jQuery plugins, Modernizr, html5shim/respond.js

Would love to use this library if I can get it working!

@jkintscher
Harvest member

I was able to reproduce this issue in IE8 Mode. So it is not related to any of the other frameworks/polyfills you are using but definitely an Issue. I'll look into this tomorrow and hope to get a fix for this out ASAP.

Thank you very much for reporting this problem. I'm going to let you know the minute it's updated, and thanks for using Harvey!

@ghost
ghost commented Nov 14, 2012

edit: Maybe I'm over-thinking this - my assumption was this would fall back to support browsers like IE8 but as I read the code and the matchmedia polyfill I'm thinking that the browser must natively support media queries for any of this to work?

I've been looking into this issue and found some things:

_build_tester() - document.body may be undefined in IE8 if executed before body is ready, I resolved this issue by attaching Harvey events in jQuery dom ready

If I have the window.matchMedia polyfill included separately before harvey.js IE8 throws an error:
SCRIPT438: Object doesn't support property or method 'addListener'

I see here https://github.com/paulirish/matchMedia.js that this script has it's own addListener method and wondering if there's a conflict or if it's just coincidence.

If I remove the polyfill noted above I get no errors in IE8, but nothing happens. The resize event isn't firing, I can get it to fire if I change the event name to 'onresize' - I was expecting 'resize' to work though in IE8.

@djeglin
djeglin commented Nov 28, 2012

Hi guys,

Are there any further developments on this, by any chance? I've been trying to use Harvey in a responsive project as well, but it is causing fairly large problems in IE, too (same as above, coupled with massive CPU spikes).

I haven't checked the source myself yet, but I just wanted to see... Does harvey watch for the window.resize() event? If so, is this check rate-limited at all? If it isn't, there is a chance that this could be causing the massive CPU spikes.

Just my $0.02... I'll take a proper look tomorrow morning and see if I can figure anything more out.

Cheers,

D

@hinok
hinok commented Dec 21, 2012

I get the same problem like inkbiegel but on MobileSafari / iPhone 2G.

Line 81
TypeError: Result of expression
'this._window_matchmedia(mediaQuery).addListe...

@jkintscher
Harvest member

This should be fixed through #11 and #13 now, or at least it’s possible to use alongside other polyfill libraries now that should mitigate the issue. If now, please feel free to follow up again!

@jkintscher jkintscher closed this Oct 15, 2013
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.