javascript - Invalid Character IE 11 - Stack Overflow

In IE 11 and IE 10 I am having a invalid character error on the line below:if (!plugin.$element.attr(``

In IE 11 and IE 10 I am having a invalid character error on the line below:

if (!plugin.$element.attr(``data-${ pluginName }``)) {

I know this is due to ES6 not being supported but I do not know how I can sort this out. Foundation already includes babel and I thought that this script below would fix the issue but hasn't.

return gulp.src(PATHS.javascript)
    .pipe($.sourcemaps.init())
    .pipe($.babel())
    .pipe($.concat('foundation.js', {
      newLine:'\n;'
    }))
    .pipe($.if(isProduction, uglify))
    .pipe($.if(!isProduction, $.sourcemaps.write()))
    .pipe(gulp.dest('assets/javascript'))
    .pipe(browserSync.stream());
});

This is a problem in the foundation.core.js file that is included with Foundation.

To see this problem you can navigate to the below url and load it in IE 11 or 10: /

Has anyone got a fix for this?

In IE 11 and IE 10 I am having a invalid character error on the line below:

if (!plugin.$element.attr(``data-${ pluginName }``)) {

I know this is due to ES6 not being supported but I do not know how I can sort this out. Foundation already includes babel and I thought that this script below would fix the issue but hasn't.

return gulp.src(PATHS.javascript)
    .pipe($.sourcemaps.init())
    .pipe($.babel())
    .pipe($.concat('foundation.js', {
      newLine:'\n;'
    }))
    .pipe($.if(isProduction, uglify))
    .pipe($.if(!isProduction, $.sourcemaps.write()))
    .pipe(gulp.dest('assets/javascript'))
    .pipe(browserSync.stream());
});

This is a problem in the foundation.core.js file that is included with Foundation.

To see this problem you can navigate to the below url and load it in IE 11 or 10: http://b20.2c7.mwp.accessdomain./

Has anyone got a fix for this?

Share Improve this question edited Nov 8, 2016 at 20:30 Kevin B 95.1k16 gold badges167 silver badges186 bronze badges asked Nov 8, 2016 at 20:07 Max LynnMax Lynn 3972 gold badges6 silver badges17 bronze badges 1
  • Why has this been marked down? – Max Lynn Commented Nov 8, 2016 at 20:12
Add a ment  | 

2 Answers 2

Reset to default 3

I fixed the problem by re installed bower and it worked fine.. odd..

Internet Explorer 11 doesn't support some of ES6 features. Along with these non supported are template literals.

See https://developer.mozilla/en-US/docs/Web/JavaScript/Reference/Template_literals for patibility.

Best approach would be to use babel and its plugin to transform template literals.

Install the babel plugin

npm install --save-dev babel-plugin-transform-es2015-template-literals

Add it in .babelrc in plugins section

// without options
{
  "plugins": ["transform-es2015-template-literals"]
}

// with options
{
  "plugins": [
    ["transform-es2015-template-literals", {
      "loose": true,
      "spec": true
    }]
  ]
}

IN gulpfile.babel.js, make sure that everything is parsed through babel-loader, so probably ment out excluded files ( most of these are foundation related ) from being parsed through babel-loader

So literals like in this example:

`foo${bar}`;

Would bee this:

"foo" + bar;

see more: https://www.npmjs./package/babel-plugin-transform-es2015-template-literals

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745648229a4638099.html

相关推荐

  • javascript - Invalid Character IE 11 - Stack Overflow

    In IE 11 and IE 10 I am having a invalid character error on the line below:if (!plugin.$element.attr(``

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信