question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tagName warning on custom component reopen

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
marcoowcommented, May 2, 2017

I think the best way to hide this warning would be to use registerWarnHandler?

0reactions
blimmercommented, Oct 20, 2018
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found