-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Dynamic input field type renders invalid code in IE11 #8379
Comments
See discussions here: #7406 In this case, we are more likely to patch code generation to suppress :value emission when both type is dynamic and v-model is set. Thanks for pointing out! |
@sodatea |
I've just experienced this exact same 'white screen' issue with IE11, whereas no warnings or problems were experienced in modern browsers (Chrome, Firefox, Safari, Edge). The IE11 JS console showed the following error:
I jumped down the rabbit hole and followed a few threads between different issues and PRs here, but struggled to find a clearly documented solution. After some trial and error, I've come up with something that works for my needs. For the benefit of others in the same situation, this is the solution I've come up with: SolutionOriginally I'd bound the <input :type="type" :value="value" v-model="model" /> Since the issue seems to stem from dynamically binding the <input v-if="type === 'checkbox'" type="checkbox" :value="value" v-model="model" />
<input v-if="type === 'radio'" type="radio" :value="value" v-model="model" /> By hardcoding the |
This commit fixes #36 – an IE11 bug which caused a 'white screen of death' as the page failed to render. The cause of this bug is discussed in vuejs/vue#8379. To summarise: the use of dynamically bound `type` attributes on `<input>` elements compiles into bad JS output, which chokes IE11. Dynamic `type` binding was used in the `SelectList` component to render either a radio or checkbox input (depending on the value of the `multiple` property). To work around this limitation, I've split both potential input types (a radio input and a checkbox input) into their own elements, and conditionally show/hide them with `v-if`. This produces different JS output which keeps IE11 happy.
This commit fixes #36 – an IE11 bug which caused a 'white screen of death' as the page failed to render. The cause of this bug is discussed in vuejs/vue#8379. To summarise: the use of dynamically bound `type` attributes on `<input>` elements compiles into bad JS output, which chokes IE11. Dynamic `type` binding was used in the `SelectList` component to render either a radio or checkbox input (depending on the value of the `multiple` property). To work around this limitation, I've split both potential input types (a radio input and a checkbox input) into their own elements, and conditionally show/hide them with `v-if`. This produces different JS output which keeps IE11 happy.
This commit fixes #36 – an IE11 bug which caused a 'white screen of death' as the page failed to render. The cause of this bug is discussed in vuejs/vue#8379. To summarise: the use of dynamically bound `type` attributes on `<input>` elements compiles into bad JS output, which chokes IE11. Dynamic `type` binding was used in the `SelectList` component to render either a radio or checkbox input (depending on the value of the `multiple` property). To work around this limitation, I've split both potential input types (a radio input and a checkbox input) into their own elements, and conditionally show/hide them with `v-if`. This produces different JS output which keeps IE11 happy.
Just spent a few hours trying to debug the same issue. |
I've also spend now some time debugging this on a async module, which complicated the bug search a lot. It would be great to have this fixed <3 |
Version
2.5.17-beta.0
Reproduction link
https://github.com/nirazul/vue-loader-bug-repro
Steps to reproduce
npm install
npm run build
npm run watch
./public/index.html
main.bundle.js
in dev toolsvalue
What is expected?
A valid output from vue-template-compiler without duplicated value props, or at least a warning that the usage of dynamic input field types is prohibited in certain cases.
What is actually happening?
In IE11 a blank page is rendered
I'm using a centralized component for both radio and checkbox input fields as the markup is 90% the same.
As we switched from webpack 3 to webpack 4, we had to also upgrade the vue-loader version from 12 to 13 or 14, which introduced this bug.
Prior to version 13, vue-template-renderer was not enforcing strict mode on all of its rendered templates. This is now the case, introducing this critical bug.
References:
https://vuejs.org/v2/guide/forms.html#Radio-1
#7048
#6917
The text was updated successfully, but these errors were encountered: