tagName warning on custom component reopen
See original GitHub issueI write a custom mixin that I apply on in test runs to automatically bind a property to all components so I can easily test to see if a given component is rendered.
Imagine I have a component foo-bar
, this logic automatically binds data-test-component='foo-bar'
to the attributes. However, because I reopen Ember.Component to get this behavior, I automatically get this behavior with components without tagNames.
Because of this new(ish) warning I get a lot of warning output in my console.
I used to be able to do this check myself:
init() {
// you can't bind attributes to tagless components
if (this.tagName !== '') {
const dataTestAttr = ['data-test-component'];
this.attributeBindings = this.attributeBindings ? this.attributeBindings.concat(dataTestAttr) : dataTestAttr;
}
this._super(...arguments);
},
but now this doesn’t work. Is there a workaround I could use to get this working again?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Using constructors as tag names · Issue #217 · lit/lit - GitHub
In doing this, I was explicitly using the imported constructor to render components. When moving to Lit, I had to start explicitly defining...
Read more >Avoid Vue warn when using custom tags - Stack Overflow
I'm getting an error when I'm trying to use custom tags like this: <material ...
Read more >Glimmer Components - Octane Upgrade Guide - Ember Guides
This means that you no longer have to customize your component using any of the following APIs: tagName; classNames; classNameBindings; attributeBindings.
Read more >Using custom elements - Web Components | MDN
The controller of custom elements on a web document is the CustomElementRegistry object — this object allows you to register a custom element...
Read more >Templating: Custom Elements Basics | Aurelia
Custom elements are not allowed to be self-closing. This means that <secret-message /> will not work. When using a custom element, you must...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think the best way to hide this warning would be to use
registerWarnHandler
?Thanks @Turbo87 . Yep, this works as I expect: https://github.com/blimmer/ember-raffle/commit/6dc758e93bcb2de2fec4ca659b32d3de9fe634e3