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

[BUGFIX beta] Undefined should not set an attribute. #10687

Merged
merged 1 commit into from
Mar 22, 2015

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Mar 21, 2015

Fixes #10595.

@rwjblue
Copy link
Member Author

rwjblue commented Mar 21, 2015

@mixonic - r?

@mmun
Copy link
Member

mmun commented Mar 21, 2015

Can you add a few assertions that assert that going from not-null/undefined to null/undefined removes the attribute?

@rwjblue
Copy link
Member Author

rwjblue commented Mar 21, 2015

@mmun - Great point!

I'm also going to add some tests that confirm this does not apply to <div data-foo={{someThingNotThere}}> as I believe that we intend this to work just like standard HTML (and add the data-foo attribute) JSBin here.

@rwjblue rwjblue force-pushed the undefined-attrs-not-set branch from bf91ab5 to 4ca66c1 Compare March 21, 2015 19:07
@rwjblue
Copy link
Member Author

rwjblue commented Mar 21, 2015

@mmun - I have changed around the implementation a bit, and added tests as you suggested. As you guessed the attribute is not removed when moving from an existing value to a null value.

Tracking this down, its basically because we are just calling element[attrName] = null (using setPropertyStrict).

@mixonic / @mmun - Thoughts on fixing this?

@mixonic
Copy link
Member

mixonic commented Mar 21, 2015

placeholder used to be set via an attribute. I'm unsure about a generic way to make property things (value, placeholder) act like attributes.

The logic from AttributeBindingNode here can likely be folded back into AttrNode. Ideally attribute bindings and htmlbars bound attributes should share behavior, since they definitely will share behavior in Glimmer.

@rwjblue
Copy link
Member Author

rwjblue commented Mar 21, 2015

I originally had it in normal AttrNode, but assumed you didn't want it to apply in non-attributeBinding scenarios. I will move the change in logic back into AttrNode...

The fix here to ensure that placeholder is not set if undefined should likely land before 1.11.0 is released. I still have the general concern (as does @mmun based his comment/question above), but that seems like a larger issue and not isolated to this PR.

I'll update to get this passing shortly.

@rwjblue rwjblue force-pushed the undefined-attrs-not-set branch from 4ca66c1 to 7681c69 Compare March 22, 2015 00:14
@rwjblue
Copy link
Member Author

rwjblue commented Mar 22, 2015

Updated to simplify and just modify AttrNode so the logic is the same. Still does not address @mmun's comment (I do not think it is possible with the current strategy of HTMLBars with regards to props & attrs).

@mmun / @mixonic - Should be ready for another round of review.

mixonic added a commit that referenced this pull request Mar 22, 2015
[BUGFIX beta] Undefined should not set an attribute.
@mixonic mixonic merged commit 2eb4edc into emberjs:master Mar 22, 2015
@mixonic mixonic deleted the undefined-attrs-not-set branch March 22, 2015 00:26
@mixonic
Copy link
Member

mixonic commented Mar 22, 2015

Thanks sir.

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

Successfully merging this pull request may close these issues.

Ember 1.11 beta: input placeholder "undefined"
3 participants