WickyNilliams / enquire.js

Awesome Media Queries in JavaScript
http://wicky.nillia.ms/enquire.js/
MIT License
3.62k stars 269 forks source link

Issue with IE10 recognizing enquire #88

Closed nickff closed 10 years ago

nickff commented 10 years ago

Hey Nicky,

So I have a site that I've been using enquire on for about a year with no issues (http://jamesmerrellarchitects.com). I was just testing the site on IE10, and unfortunately I'm getting an error (works great in IE9 though).

The error I'm getting is: SCRIPT5009: 'enquire' is undefined scripts.js, line 263 character 5

I'm running enquire within this file, right towards the bottom - http://jamesmerrellarchitects.com/assets/js/scripts.js

And here's my code:

//animate the icons differently depending on small screen or not.
Modernizr.load([
    {
        test: window.matchMedia,
        nope: "assets/js/matchMedia.js"
    },
    {
        load : "assets/js/enquire.js",
        complete : function() {
            $(function() {
                enquire.register("screen and (min-width:581px)", { 
                    match : function() {
                        INIT.menu_animate();
                    }
                }, true).register("screen and (max-width:580px)", {
                    match : function() {
                        INIT.mobile_menu_animate();
                    }
                }).fire();  
            });
        }
    }
]);

Basically, it animates the bottom menu icons differently based on screensize.

If you have any thoughts on why this would be giving me an error in IE10, it would be hugely appreciated!

WickyNilliams commented 10 years ago

What version of enquire are you using? You have a call to fire in there so I assume that it's an old version. You may wish to try v2.1.0, there are details of change and upgrade path in the documentation here http://wicky.nillia.ms/enquire.js/#v2.0.0

Is anything else being logged to the console? It strikes me as odd that nothing else is logged before that

Cheers On 20 Nov 2013 17:47, "Nick Hoag" notifications@github.com wrote:

Hey Nicky,

So I have a site that I've been using enquire on for about a year with no issues (http://jamesmerrellarchitects.com). I was just testing the site on IE10, and unfortunately I'm getting an error (works great in IE9 though).

The error I'm getting is: SCRIPT5009: 'enquire' is undefined scripts.js, line 263 character 5

I'm running enquire within this file, right towards the bottom - http://jamesmerrellarchitects.com/assets/js/scripts.js

And here's my code:

//animate the icons differently depending on small screen or not. Modernizr.load([ { test: window.matchMedia, nope: "assets/js/matchMedia.js" }, { load : "assets/js/enquire.js", complete : function() { $(function() { enquire.register("screen and (min-width:581px)", { match : function() { INIT.menu_animate(); } }, true).register("screen and (max-width:580px)", { match : function() { INIT.mobile_menu_animate(); } }).fire();

}); } } ]);

Basically, it animate the bottom menu icons differently based on screensize.

If you have any thoughts on why this would be giving me an error in IE10, it would be hugely appreciated!

— Reply to this email directly or view it on GitHubhttps://github.com/WickyNilliams/enquire.js/issues/88 .

nickff commented 10 years ago

Hey Nicky,

I've updated to the latest version and removed all references to fire() and listen(). Still getting the error in IE10, and nothing else appearing in the console.

Also, I'm now getting the error and the functions no longer run properly in IE9 as well.

You mention something about matchMedia having an addListener event. I just have the standard matchMedia script included. Could this have anything to do with it? Any other thoughts or ideas?

WickyNilliams commented 10 years ago

Hmm very strange. Do the examples on the documentation work? E.g. http://wicky.nillia.ms/enquire.js/examples/setup/ On 20 Nov 2013 18:41, "Nick Hoag" notifications@github.com wrote:

Hey Nicky,

I've updated to the latest version and removed all references to fire() and listen(). Still getting the error in IE10, and nothing else appearing in the console.

Any other thoughts or ideas?

— Reply to this email directly or view it on GitHubhttps://github.com/WickyNilliams/enquire.js/issues/88#issuecomment-28916161 .

nickff commented 10 years ago

Hmm, it looks like it comes back with an "X" and "Unmatched" when testing on IE10:

screen shot 2013-11-20 at 1 59 50 pm

WickyNilliams commented 10 years ago

Looks like there probably is an issue then, it's not supposed to look like that :) what's logged in the console for the examples?

Unfortunately I don't have access to a machine with IE 10 on it at the moment, so determining the issue might prove a challenge!

I'll keep you posted.

nickff commented 10 years ago

Sure thing, here's what I'm getting in the console:

SCRIPT438: Object doesn't support property or method 'ready' 
zepto.min.js, line 1 character 3833
SCRIPT438: Object doesn't support property or method 'find' 
examples.min.js, line 1 character 68
SCRIPT5007: Unable to get property 'setup' of undefined or null reference 
setup, line 76 character 3
CSS3111: @font-face encountered unknown error. 
zLhfkPOm_5ykmdm-wXaiuw.eot

Also, if interested I would be happy to pass along some log in credentials for browserstack.com so you can test properly. Let me know and I can send via email.

WickyNilliams commented 10 years ago

Thanks for that.

That's an incredibly kind offer. I'll first try to get some VMs set up on my mac, I've been meaning too do it for a long time so this provides a good incentive to finally do so. If that fails for any reason I'll definitely take you up on that offer. Thanks again

WickyNilliams commented 10 years ago

Does the following fiddle work? http://jsfiddle.net/3nXce/71/

I have a windows 8 VM running IE10 and it's working fine (though admittedly the example doesn't work on the enquire site because Zepto isn't compatible with IE, I'll fix that separately)

nickff commented 10 years ago

Yea, that looks like it works. My issue must like elsewhere, then... stumped.

WickyNilliams commented 10 years ago

I'll have a look at the site tomorrow and try to debug your issue :)

WickyNilliams commented 10 years ago

(also I'll close this for now since it doesn't seem to be an enquire bug, but feel free to continue any discussion)

nickff commented 10 years ago

Man, that would be amazing. Thanks so much Nicky. I have reverted back to my original version of enquire with fire() and listen(), just so it works in IE9. Once you are debugging stuff just let me know and I will be happy to make the change again to the new version.

nickff commented 10 years ago

Hi @WickyNilliams,

Just checking in on this to see if you ever had time to check the site out and debug the issue I was having.

Let me know. Thanks so much!!