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

Bad parsing when bound data contains a backtick #3273

Closed
sirlancelot opened this issue Jul 13, 2016 · 5 comments
Closed

Bad parsing when bound data contains a backtick #3273

sirlancelot opened this issue Jul 13, 2016 · 5 comments
Labels

Comments

@sirlancelot
Copy link
Contributor

@sirlancelot sirlancelot commented Jul 13, 2016

Vue.js version

1.0.26

Reproduction Link

http://codepen.io/sirlancelot/pen/zBPVBo?editors=1010#0

Steps to reproduce

  • Bind an inline object with a value containing the backtick character

What is Expected?

  • Object is reproduced properly in the data model

What is actually happening?

  • scope. is being added to everything between the backtick and an escaped quote.

We're using props to curry an initial data model from the server to the browser. We're doing it in a manner similar to the example shown in the CodePen. Basically, our root Vue instance contains a list of props that will show up on the element and are populated by the server.

@kazupon kazupon added the bug label Jul 14, 2016
@Etheryte
Copy link

@Etheryte Etheryte commented Jul 14, 2016

As a temporary workaround, you can bypass the issue by escaping the backtick.

//broken
:items="[{'title':'one','value':1},{'title':'t`wo','value':2}]"

//works
:items="[{'title':'one','value':1},{'title':'t\`wo','value':2}]"

For anyone investigating, it seems that the issue doesn't occur when the array contains only a single element.

@skyronic
Copy link
Contributor

@skyronic skyronic commented Jul 19, 2016

I made a change to a regular expression and this seems to be working fine now. However this seemed like a very important regexp and I am not sure of the patch.

Before

screen shot 2016-07-19 at 10 45 27 pm

After

(I've highlighted the part in red)

screen shot 2016-07-19 at 10 45 02 pm

@LinusBorg
Copy link
Member

@LinusBorg LinusBorg commented Jul 22, 2016

@skyronic what RegExp tool is that? looks very useful...

@skyronic
Copy link
Contributor

@skyronic skyronic commented Jul 22, 2016

@LinusBorg - I used https://www.debuggex.com/ very handy!

@heygambo
Copy link

@heygambo heygambo commented Sep 27, 2016

@skyronic thx! I use http://rubular.com/ a lot. It tests with the ruby lib but works fine too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants