Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

filter with empty arguments cause error in chrome 57- #7544

Closed
lxjwlt opened this issue Jan 27, 2018 · 1 comment · Fixed by #7545
Closed

filter with empty arguments cause error in chrome 57- #7544

lxjwlt opened this issue Jan 27, 2018 · 1 comment · Fixed by #7545
Assignees

Comments

@lxjwlt
Copy link

lxjwlt commented Jan 27, 2018

Version

2.5.13

Reproduction link

https://jsfiddle.net/lxjwlt/ajy768fs/

Steps to reproduce

in chrome 57 and 56,

  1. filter with empty arguments:

    <div>{{text | someFilter()}}</div>
  2. when no parentheses:

    <div>{{text | someFilter}}</div>

What is expected?

  1. no error
  2. no error

What is actually happening?

1.in chrome 57 and 56, report error:

[Vue warn]: Error compiling template:

<div>{{text | someFilter()}}</div>

- invalid expression: Unexpected token ) in

    _s(_f("someFilter")(text,))

  Raw expression: {{text | someFilter()}}



(found in <Root>)

2.no error


I have also examined the chrome 58 and 63 which have no errors both, so i guess this bug only occurs in chrome 57-.

mac-chrome57: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/444958/

win-chrome57: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win/444958/

@posva posva self-assigned this Jan 27, 2018
posva added a commit to posva/vue that referenced this issue Jan 27, 2018
Fix vuejs#7544
Make sure no extra , is added at the end of the call so it also work with older browsers
@posva
Copy link
Member

posva commented Jan 27, 2018

It was generating someFilter(text,) which fails in older browsers.
FYI you can do text | someFilter when there're no arguments

yyx990803 pushed a commit that referenced this issue Mar 8, 2018
Fix #7544
Make sure no extra , is added at the end of the call so it also work with older browsers
f2009 pushed a commit to f2009/vue that referenced this issue Jan 25, 2019
Fix vuejs#7544
Make sure no extra , is added at the end of the call so it also work with older browsers
aJean pushed a commit to aJean/vue that referenced this issue Aug 19, 2020
Fix vuejs#7544
Make sure no extra , is added at the end of the call so it also work with older browsers
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants