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

[1.13.0 Regression] Views doesn't use attributeBindings #11480

Closed
marcemira opened this issue Jun 16, 2015 · 12 comments
Closed

[1.13.0 Regression] Views doesn't use attributeBindings #11480

marcemira opened this issue Jun 16, 2015 · 12 comments

Comments

@marcemira
Copy link

Hello, I have been using attributeBindings: ['id'] in order to assign id to my route's view. This way I can "namespace" css by route. This has stopped working since 1.13.0 (same as in components). I understand the reasons here #11141 , but it's not valid for a routes view, since it's not written in templates. Am I not folliwing the "right way" or it's really a regression (please feel free to replace the title if not)? Thanks!

@rwjblue
Copy link
Member

rwjblue commented Jun 16, 2015

Confirmed that attributeBinding for id is not working. Here is a JSBin demo.

@marcemira
Copy link
Author

@rwjblue here's a JSBin demo

@mixonic
Copy link
Member

mixonic commented Jun 18, 2015

I do not suggest using an id binding like this, but it seems like a regression.

@marcemira
Copy link
Author

Any progress on this issue?

@nybblr
Copy link

nybblr commented Sep 21, 2015

Same issue here on Ember 1.13.9: I have a component like such:

export default Ember.Component.extend({
  tagName: 'a',
  href: '#',
  id: 'my-component',
  attributeBindings: ['href', 'id'],
  click: function(event) {
    event.preventDefault();
    console.log("CLICK");
  }
}

Interestingly, the id attributeBinding breaks all event handlers (e.g. click never fires), but removing just id from the attributeBindings makes events work again.

@nybblr
Copy link

nybblr commented Sep 21, 2015

Ah, I get what's happening here. Just to make sure it wasn't related to the concatenatedProperties bug resolved in 1.13.10, I upgraded. Same problem.

But when you attributeBind to id, it overrides the unique ember256 id that is added, presumably for binding those event handlers.

Is there a workaround for this or more relevant issue?

@rwjblue
Copy link
Member

rwjblue commented Sep 21, 2015

The demo JSBin seems to be working properly on release-1-13 branch: http://emberjs.jsbin.com/tufosiz/edit?js,output.

@rwjblue
Copy link
Member

rwjblue commented Sep 21, 2015

Was fixed in #11889.

@nybblr
Copy link

nybblr commented Sep 21, 2015

#11889 did fix not being able to bind to id at all, but seems to break any event handlers (e.g. a click handler).

Try adding a "click" handler to your example (e.g. an alert) and notice it doesn't fire when attributeBindings includes id. Drop id and try again (I had to change the CSS styling to target the class instead of ID so I could still see the square) and notice the click handler works now.

@runspired
Copy link
Contributor

it appears you can get around this bug by binding like this

attributeBindings: ['id:id', 'href:href']

@Serabe
Copy link
Member

Serabe commented Apr 18, 2016

@rwjblue this is still happening in 2.5.0 when the attribute being passed is static. Check in previous twiddle that it works for {{attr-test}} and {{attr-test rows=externalRows}} but not for {{attr-test rows=4}}.

@Serabe
Copy link
Member

Serabe commented Apr 16, 2017

Seems fixed in 2.12 (Ember-Twiddle). Closing this.

Thank you everyone!

@Serabe Serabe closed this as completed Apr 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants