- edited description
HTML should see custom events that are defined on a LWC's superclass.
Issue #2196
resolved
Conditions:
- Create an LWC superComponent
-
Add the following:
superEvent() { this.dispatchEvent(new CustomEvent('superevent')); }
-
Create an LWC subComponent, and make the class extend superComponent
- Add the following:
subEvent() { this.dispatchEvent(new CustomEvent('subevent')); }
handleSubEvent(evt) { console.log('Sub'); }
handleSuperEvent(evt) { console.log('Super'); }
-
Create a demo component demoComponent:
- Add the subclass component to the HTML:
<c-sub-component onsubevent={handleSubEvent} onsuperevent={handleSuperEvent}></c-sub-component>
Current Functionality:
- ‘onsubevent’ is recognised
- ‘onsuperevent’ is highlighted with warning ‘Attribute onsuperevent is not allowed here’
Enhancement request:
- ‘onsuperevent’ is recognised
Comments (4)
-
reporter -
reporter - edited description
-
repo owner Thanks for reporting. This was a very simple oversight where all other attribute discovery based on the controller file would occur taking into considering the inheritance hierarchy, but the search for raised
CustomEvent
s would not. I’ve committed a fix for the next build. -
repo owner - changed status to resolved
Delivered in 2.2.3.6.
- Log in to comment