Framework: Creating component called CustomElement doesn't work

Created on 16 Nov 2016  路  7Comments  路  Source: aurelia/framework


I'm submitting a bug report

  • Library Version:
    major

Please tell us about your environment:

  • Operating System:
    OSX 10.x|Linux (distro)|Windows [7|8|8.1|10]
  • Node Version:
    7.0.0

  • NPM Version:
    3.10.8

  • Browser:
    all

  • Language:
    all

Current behavior:
Today I stumbled accross weird behaviour namely when I created simple component called CustomElement and then tried to use it, it just didn't work. When I changed the name of this component everything worked fine.
See gist:
https://gist.run/?id=2adaa198215f8bdee166eaa54021bf7c

As you can see NavBar component displays message and CustomElement doesn't.

Expected/desired behavior:
Probably this class name has been resereved by Aurellia so I think that at least some kind of warning should be put in console

bug documentation

Most helpful comment

@Thanood here's a facepalm gif I use whenever I make this mistake:

facepalmt

Because I do make this mistake from time to time :-)

All 7 comments

Yes, that's part of the convention system. We should add something to detect if you actually name a custom element CustomElement.

Maybe related, I just recently named one custom attribute's property activates and another activatesRef (to optionally hold a ref of an element). The property activatesRef was always null until I renamed it.

If that's also part of the convention, I think it should be documented as well. 馃槂

activatesRef as a property in JS would be activates-ref in html. That should be documented already in the templating docs.

Did I do that error again? Where's the facepalm emoji? Sorry. :smiley:
Somehow I tend to forget that this is also true for custom attribute properties like this:
<button md-dropdown="activates-ref.bind: someOtherElement">

@Thanood here's a facepalm gif I use whenever I make this mistake:

facepalmt

Because I do make this mistake from time to time :-)

epic 馃槂

Save the gif

Can be closed

Was this page helpful?
0 / 5 - 0 ratings