0

我正在尝试使用这个polyfill 来允许我在 IE8 和 9 中使用 flexbox,但我只是遇到了错误。

我的项目中包含版本 1.0.6,因为根据问题,最新版本不起作用

然后我在我的 site.js 文件中使用以下代码调用它:

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);
}

但是,我在 IE9 的控制台中收到以下错误:

Function expected 

我也尝试使用以下代码(没有包装 if 语句):

flexibility(document.documentElement);

但我在 Chrome 中收到以下错误

flexibility is not a function

有没有人使用过这个 polyfill 并且它以前工作过,或者能够帮助我让它工作?我不确定我是否错误地调用了该函数,或者 polyfill 本身是否存在错误。

4

0 回答 0