Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Edge / IE console error: Function Expected #62

Closed
damienmcd opened this issue Jan 12, 2017 · 7 comments
Closed

Edge / IE console error: Function Expected #62

damienmcd opened this issue Jan 12, 2017 · 7 comments

Comments

@damienmcd
Copy link

damienmcd commented Jan 12, 2017

I'm seeing this error on Edge, IE11 and IE10.
Seeing 'Function Expected' in the console.
The CSS is implemented with the following:

.image {
  object-fit: cover;
  object-position: center;
  font-family: 'object-fit: cover; object-position: center;'
}

Calling Object Fit in JQuery as follows:

jQuery(function($) {
  objectFitImages();
});
@fregante
Copy link
Owner

The demo works for me in IE 11. Can you post the full error you're seeing?

@damienmcd
Copy link
Author

damienmcd commented Jan 13, 2017

The full error in Edge is:

SCRIPT5002: Function Expected
main-min.js (68,5882)

I've updated the initial comment as I've narrowed down the other error that I was seeing but still seeing the issue with the "Function Expected" console error at the objectFitImages section of our main-min.js

@damienmcd damienmcd changed the title Edge / IE console error: "Unable to get property 'length' of undefined" Edge / IE console error: Function Expected Jan 13, 2017
@fregante
Copy link
Owner

I don't think the error is caused by OFI. Post the website that you're seeing this issue on so I can take a look.

Make sure you're loading OFI correctly. Are you using browserify? Webpack? How are you loading OFI?

@damienmcd
Copy link
Author

I'm currently seeing the issue while testing a local build.
OFI is being prepended using CodeKit and being called within JQuery with

objectFitImages();

@fregante
Copy link
Owner

Try running

jQuery(function() {
    console.log(typeof objectFitImages);
});

What's its output in the console?

Which OFI file are you prepending? ofi.min.js?

@damienmcd
Copy link
Author

I've just downloaded the latest release from GitHub and am prepending ofi.min.js and it seems to be working fine now.
I'm not sure what version we had previously as it was added by one of our other devs.
This issue can be closed. Thanks for your help on this.

@ugrupp
Copy link

ugrupp commented Feb 9, 2017

confirmed, upgrading from 2.5.3 to 3.1.0 resolved the issue for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants