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

Getting 'Uncaught TypeError: Right-hand side of 'instanceof' is not callable' when doing simple validation #730

Closed
ftom2 opened this issue Aug 15, 2017 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@ftom2
Copy link

ftom2 commented Aug 15, 2017

Versions:

  • VueJs: 2.4.2
  • Vee-Validate: 2.0.0-rc.12
  • Chrome: Version 60.0.3112.101 (Official Build) (64-bit)

Description:

I have a modal with a text input field:

<input type="text" class="form-control" id="tenantName" placeholder="Tenant Name"
                   v-model="name" name="name" v-validate="'required|min:3'" :disabled="!!id">
            <span class="text-danger error" v-show="errors.has('name')">{{ errors.first('name')}}</span>

As soon as I start to type something in the field i get this error:

VM1134:1 Uncaught TypeError: Right-hand side of 'instanceof' is not callable
    at eval (eval at fn (vee-validate.js?e134:3670), <anonymous>:1:5)
    at VueComponent.fn (vee-validate.js?e134:2384)
    at Watcher.run (vue.esm.js?efeb:2972)
    at flushSchedulerQueue (vue.esm.js?efeb:2724)
    at Array.eval (vue.esm.js?efeb:701)
    at nextTickHandler (vue.esm.js?efeb:648)
    at <anonymous>

I tracked the error to this line:
if (args.length === 0 || args[0] instanceof Event)

Seems like a JS thing since when trying to run "a" instanceof Event I get the same error

Steps To Reproduce:

Create a simple input field like:

<input type="text" class="form-control" id="tenantName" placeholder="Tenant Name"
                   v-model="name" name="name" v-validate="'required|min:3'" :disabled="!!id">
            <span class="text-danger error" v-show="errors.has('name')">{{ errors.first('name')}}</span>

and once you start typing you should see the error.

@logaretm
Copy link
Owner

logaretm commented Aug 15, 2017

Could be related to #679 and #722, in short if you are overwriting Event constructor of the window, you shouldn't as it is a native constructor that is needed for multiple reasons, and it could be needed for other libraries out there as well. I can add a check for it in future versions.

@logaretm logaretm added the duplicate This issue or pull request already exists label Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants