Skip to content

[Bug Report] VTextField: Syntax error in regular expression in function unmaskText in IE11 #8917

@niutech

Description

@niutech

Environment

Vuetify Version: 1.5.17
Vue Version: 2.6.10
Browsers: Internet Explorer
OS: Windows 10

Steps to reproduce

Make a <v-text-field> with a mask and type any text in IE11. The value will not be set and you will get the Syntax error in regular expression in the console.

Expected Behavior

The masked text fields should be usable in IE11.

Actual Behavior

You cannot fill in the masked text fields.

Reproduction Link

https://jsbin.com/majopojiqi/edit?js,console (open in IE11)

Other comments

The problem is in the file src/util/mask.ts, in the line:

const defaultDelimiters = /[-!$%^&*()_+|~=`{}[\]:";'<>?,./\\ ]/

which is used by the function unmaskText:

new RegExp(defaultDelimiters, 'g')

However, IE11 requires the new RegExp(pattern, flags) constructor to provide the pattern as a String, not a RegExp object. The solution is to set:

const defaultDelimiters = "[-!$%^&*()_+|~=`{}[\]:\";'<>?,./\\ ]"

Metadata

Metadata

Assignees

Labels

C: VTextFieldT: bugFunctionality that does not work as intended/expectedltsplatform specificThe issue only occurs on a specific platform

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions