Skip to content

Issue with dynamic input[:type] bindings in Internet Explorer (IE 10/11) #4989

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

Closed
rs3d opened this issue Dec 23, 2019 · 1 comment
Closed

Comments

@rs3d
Copy link

rs3d commented Dec 23, 2019

Version

4.1.1

Reproduction link

https://github.com/rs3d/vuejs-input-type-binding-issue

Environment info

  • Using preset @vue/cli-plugin-babel/preset
  • package.json:
"dependencies": {
   "core-js": "^3.6.0",
   "vue": "^2.6.11"
 },
 "devDependencies": {
   "@vue/cli-plugin-babel": "^4.1.1",
   "@vue/cli-plugin-eslint": "^4.1.1",
   "@vue/cli-service": "^4.1.1",
   "babel-eslint": "^10.0.3",
   "eslint": "^6.8.0",
   "eslint-plugin-vue": "^6.0.1",
   "vue-template-compiler": "^2.6.11"
 },
  • Tested in IE9, IE10, IE11

Steps to reproduce

I'm trying to create a simple <input>-element component, which has dynamic type bindings
like <input[:type="text|number|tel|email|radio|checkbox"]>.

The following template-example-code is working as intended in all browsers,
but IE10 and IE11 is throwing an error, when this code is used:

data.checkbox = []

<template>
  <div>
    {{ checkbox }}
    <div v-for="(field, index) in [{ type: 'checkbox', value: 'TEST '}]" :key="index">
      <input :type="field.type" :value="field.value" v-model="checkbox">
      {{ field }}
    </div>
  </div>
</template>

What is expected?

Standard :type-bindings similar to value-bindings like the input[radio]:value example in the docs:
https://vuejs.org/v2/guide/forms.html#Radio-1

First I've thought it's related with vuejs directly, but a basic example without transpilation is working as expected:
vuejs/vue#10945 (comment)

What is actually happening?

IE10/11 error message:

Multiple definitions of a property not allowed in strict mode

IE9 is working though.


Even if I'm using :type="'checkbox'" to bind it directly to a string, it's not working in IE.

So currently I need to use type="checkbox" with an v-if="type ==='checkbox'" condition as workaround.

@LinusBorg
Copy link
Member

Sorry to send you back to the core repo, but this is a duplicate of vuejs/vue#8379

It is in fact related to Vue core, or rather vue-template-compiler. That ticket has been open for quite some time, it seemed to be an edge case but maybe we need to get at it again.

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