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

dom-if contents show regardless of whether condition is true or false #4643

Closed
3 of 5 tasks
HughxDev opened this issue May 30, 2017 · 3 comments
Closed
3 of 5 tasks
Assignees
Labels

Comments

@HughxDev
Copy link

Live Demo

http://jsbin.com/quhezacofo/edit?html,output

Steps to Reproduce

  1. Use two dom-ifs in a template.
  2. Put something different in each dom-if.
  3. Point one dom-if’s if attribute to an expression that evaluates to true; the other false.

Expected Results

Conditional loading of the different things.

Actual Results

Both things load every time.

Browsers Affected

  • Chrome
  • Firefox
  • Edge (not tested)
  • Safari 10
  • IE 11 (not tested)

Versions

  • Polymer: v2.0.0
  • webcomponents: v1.0.1
@HughxDev HughxDev changed the title dom-if evaluates regardless of whether condition is true or false dom-if contents show regardless of whether condition is true or false May 30, 2017
@Westbrook
Copy link
Contributor

Westbrook commented May 30, 2017

Looks like if you pull out some of the spaces in your binding this issue does away: http://jsbin.com/qedapijulo/edit?html,output

tldr; {{isMultipleChoice(question.type)}} instead of {{isMultipleChoice( question.type )}}...

I DO feel like this has been addressed at some point in 1.x, but maybe there was a performance benefit that was found to rationalize adding back this strictness?

@kevinpschaaf kevinpschaaf self-assigned this May 30, 2017
@HughxDev
Copy link
Author

Coming from Angular development I don’t expect this kind of behavior at all. I would assume that whitespace around parameters for readability is irrelevant, as it is in regular JavaScript. (On that note, I also expect to be able to do comparison directly in the if attribute rather than outsourcing it to a helper method, but I digress.) I see this is P1 now, but if it does turn out to be expected behavior I think it would be crucial to see that reflected in the docs. Thank you.

@kevinpschaaf
Copy link
Member

kevinpschaaf commented May 31, 2017

There is a bug in the parsing code, will be fixed.

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

No branches or pull requests

3 participants