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

Compiler: v-on access _cache in hoisted element outside render function if handler is empty #1716

Closed
rhengles opened this issue Jul 26, 2020 · 0 comments

Comments

@rhengles
Copy link

Version

3.0.0-rc.3

Reproduction link

https://jsbin.com/rafugesite/edit?html,js,console,output

Steps to reproduce

sometimes you create a v-on:event="" while developing but forget to call anything inside the event handler. When the handler is empty, the element is hoisted and that generates a code that tries to access the "_cache" variable outside the render(_ctx, _cache) function.

This causes an error that is not easy to understand.

What is expected?

Compile without error (empty handler doesn't do anything), or maybe print a warning "empty v-on handler found"

What is actually happening?

ReferenceError: _cache is not defined

underfin added a commit to underfin/vue-next that referenced this issue Jul 27, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant