Dear Ember.JS team, for your consideration:
We have things like title
and draggable
natively: attributes that
add behavior to an element. I'd like this ability in ember. It could
work something like this:
App.TooltipDecorator = Ember.Decorator.extend({
tooltipElement: function() {
return Ember.$('#'+this.get('tooltip'));
}.property('tooltip'),
show: function() {
this.get('tooltipElement').show().position({
of: this.$()
});
},
hide: function() {
this.get('tooltipElement').hide();
}.on('didInsertElement')
mouseEnter: Ember.aliasMethod('show'),
mouseLeave: Ember.aliasMethod('hide').on('didInsertElement')
// basically the api in here is the same as for an Ember.View,
// with dom event hooks, this.$(), on('didInsertElement') etc.
});
And the template:
Thanks.
It's actually quite similar to that and possibly even the correct implementation. Let's think about how this fits in with web components (my only concern in the past) and get this on the docket. Maybe we'll Eben be able to influence the spec.