lifeart / ember-ref-modifier

Ember Ref Modifier
MIT License
44 stars 7 forks source link

Cannot name the variable "element" in a Glimmer component #185

Open boris-petrov opened 4 years ago

boris-petrov commented 4 years ago

That is, doing:

<div {{ref this "element"}}></div>

Leads to:

Error: You attempted to access the 'element' property on a Glimmer Component, but that property does not exist in Ember.js applications, it only exists in Glimmer.js apps. You define a class field with the same name on your component class and it will overwrite this error message, but it will not be used by the framework.
lifeart commented 4 years ago

Looks like it's an internal Ember check.

lifeart commented 4 years ago

https://github.com/glimmerjs/glimmer.js/blob/master/packages/%40glimmer/component/src/component.ts#L137

boris-petrov commented 4 years ago

@lifeart - yes, but I still believe it is an ember-ref-modifier bug because it has to "set" the value in such a way that Ember doesn't complain. I guess.

lifeart commented 4 years ago

ember-ref modifier use set from @ember/object, can't see issue here https://github.com/lifeart/ember-ref-modifier/blob/master/addon/modifiers/ref.js#L45 https://github.com/lifeart/ember-ref-modifier/blob/master/addon/modifiers/ref.js#L60