Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for IE11 (ES5) #23

Open
Timo-DK opened this issue Oct 31, 2018 · 1 comment
Open

Support for IE11 (ES5) #23

Timo-DK opened this issue Oct 31, 2018 · 1 comment

Comments

@Timo-DK
Copy link

Timo-DK commented Oct 31, 2018

Hello,

I've implemented vue-switches in a software solution, and concluded that vue-switches is not (yet) supported for IE11.

At https://github.com/drewjbartlett/vue-switches/blob/master/src/switches.vue#L58 IE11 is complaining about the mounted function. There are some other places where this happens.

The cause for this is because in ES6 the shorthand function for object initializers is introduced.

Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions

The VueJS documentation is suggesting to use the following style:

mounted: function () {
  this.$nextTick(function () {
    // Code that will run only after the
    // entire view has been rendered
  })
}

Reference: https://vuejs.org/v2/api/#mounted

Transcompiling the node_modules directory is not a really effecient option.

Option 1 - Manual "downgrade" the syntax to ES5

It would be fairly simple to implement this and support IE11 without the need of a transcompiler.

If there aren't any plans to fix this, I could fix it myself and send a PR.

Pros:

  • Able to support IE11

Cons:

  • Every time the source gets updated, it has to be checked if it is still compatible for IE11, if not then it has to be changed to older syntax

Option 2 - Transcompile the source

Transcompile the source to ES5 before distribubtion (eg. npm).

Pros:

  • Able to support IE11
  • Don't have to worry about using new syntax (ES6, ES7 etc.)

Cons:

  • Requires set-up to handle transcompiling (eg. Babel)
@Timo-DK Timo-DK changed the title Support for IE11 Support for IE11 (ES5) Oct 31, 2018
@Roye7777777
Copy link

Roye7777777 commented Apr 30, 2020

A primary issue is that on rule 58 in switches.vue, the syntax mounted () { is not supported in IE, thus causing all other layout to break. Adjusting that (as mentioned above) to mounted: function () { would fix it.

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

No branches or pull requests

2 participants