0

I'm trying to use this polyfill to allow me use flexbox in IE8 and 9, but I'm just getting errors.

I have version 1.0.6 included in my project, as the latest version doesn't work according to the issues.

I am then calling it using the following code in my site.js file:

function supportsFlexBox() {
    var test = document.createElement('test');

    test.style.display = 'flex';

    return test.style.display === 'flex';
}

if (supportsFlexBox()) {
    // Modern Flexbox is supported
} else {
    flexibility(document.documentElement);
}

However, I am getting the following error in console on IE9:

Function expected 

I have also tried using just the following code (without the wrapping if statement):

flexibility(document.documentElement);

But I get the following error in Chrome

flexibility is not a function

Has anyone used this polyfill and it working before, or able to help me get this working? I'm not sure if im calling the function incorrectly or if there is a bug in the polyfill itself.

Sam Willis
  • 4,001
  • 7
  • 40
  • 59
  • Does it happen if you wrap your code in `document.addEventListener("DOMContentLoaded", function() {…})`? I suspect you might be calling `flexibility` before it actually loads. – helb Feb 27 '17 at 18:26
  • Unfortunately that still gives the same error – Sam Willis Feb 28 '17 at 09:21
  • 1
    Yeah, sorry, just tried it on Codepen and it doesn't help. Version 2.0.1 loads without errors, but it's broken in another ways… And the upstream seems to be abandoned. – helb Feb 28 '17 at 09:56
  • Ah well, guess I'll have to just use css to fix any flex issues until there's a working polyfill available. Thanks for you help – Sam Willis Feb 28 '17 at 15:11

0 Answers0