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

template if expression, trailing blanks should be ignored #370

Closed
nbouthors opened this issue Dec 13, 2013 · 2 comments
Closed

template if expression, trailing blanks should be ignored #370

nbouthors opened this issue Dec 13, 2013 · 2 comments
Assignees

Comments

@nbouthors
Copy link

Trailing blank in template if cause the test to fail.
if this.classname=="something" and this.static==false in a polymer element

  <template if='{{(classname!="" )&& (static==true)}} '>   <!-- template appears -->

  <template if='{{(classname!="" )&& (static==true)}}'>   <!-- template does not appears -->
@dfreedm
Copy link
Member

dfreedm commented Dec 16, 2013

Fixed syntax highlighting.

In the future, you should use fenced code blocks so the html code shows up :)

@jmesserly
Copy link
Contributor

hmmm. I'm not entirely sure we want to change behavior here, though @rafaelw is the person to know for sure.

There is a difference between "{{ binding }}" vs having text on either side like "some {{ binding }} text". The former is treated as a data value, and can have a type like boolean. The latter is always a string. Imagine if you wrote false + ' ' in JavaScript. You'd get the string "false ". Same thing happens here. Even if we converted it to boolean, we'd still get true, which you can see from the JavaScript console: if ("false ") console.log("it's true!");

going to close tentatively, but please to let me know if I got that wrong. It definitely happens :)

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

No branches or pull requests

3 participants