question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic input field type renders invalid code in IE11

See original GitHub issue

Version

2.5.17-beta.0

Reproduction link

https://github.com/nirazul/vue-loader-bug-repro

Steps to reproduce

  1. npm install
  2. npm run build
  3. npm run watch
  4. Open ./public/index.html
  5. Inspect main.bundle.js in dev tools
  6. On line 9044 you will find a duplicated key value

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 https://github.com/vuejs/vue/issues/7048 https://github.com/vuejs/vue/issues/6917

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ollietreendcommented, Mar 5, 2019

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:

Multiple definitions of a property not allowed in strict mode

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:

Solution

Originally I’d bound the input type attribute to a variable, which would either be checkbox or radio:

<input :type="type" :value="value" v-model="model" />

Since the issue seems to stem from dynamically binding the type attribute, I changed my template to conditionally render the input using v-if:

<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 type attribute for each of the possible types, and showing them conditionally depending on the value of type, I was able to workaround this particular bug. IE11 seems to be fine with this.

0reactions
rs3dcommented, Dec 27, 2019

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 ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

[template-compiler] Using both v-bind:value and v-model on ...
IE11 throws an error: "duplicate properties not allowed in strict mode". I realize that using both v-bind:value and v-model on an input is...
Read more >
Fix web compatibility issues using document modes and the ...
Test your sites for document mode compatibility · Go to a site having compatibility problems, press F12 to open the F12 Developer Tools,...
Read more >
Handling common HTML and CSS problems - MDN Web Docs
In the Search packages text field, type "lint" and press Enter/Return to search for linting-related packages. You should see a package called ...
Read more >
FAQs - styled-components
The warning message below indicates that non-standard attributes are being attached to HTML DOM elements such as <div> or <a>. If you are...
Read more >
input type=range not styling in ie11 - Stack Overflow
In ie11, the input type=range tag is displayed with default padding. Remove the padding when the tag is styled, for example,
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found