File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ export const FormRegisteringMixin = dedupeMixin(
1313 superclass =>
1414 // eslint-disable-next-line no-shadow, no-unused-vars
1515 class FormRegisteringMixin extends superclass {
16+ constructor ( ) {
17+ super ( ) ;
18+ this . __boundDispatchRegistration = this . _dispatchRegistration . bind ( this ) ;
19+ }
20+
1621 connectedCallback ( ) {
1722 if ( super . connectedCallback ) {
1823 super . connectedCallback ( ) ;
@@ -31,9 +36,10 @@ export const FormRegisteringMixin = dedupeMixin(
3136 if ( formRegistrarManager . ready ) {
3237 this . _dispatchRegistration ( ) ;
3338 } else {
34- formRegistrarManager . addEventListener ( 'all-forms-open-for-registration' , ( ) => {
35- this . _dispatchRegistration ( ) ;
36- } ) ;
39+ formRegistrarManager . addEventListener (
40+ 'all-forms-open-for-registration' ,
41+ this . __boundDispatchRegistration ,
42+ ) ;
3743 }
3844 }
3945
@@ -44,6 +50,10 @@ export const FormRegisteringMixin = dedupeMixin(
4450 bubbles : true ,
4551 } ) ,
4652 ) ;
53+ formRegistrarManager . removeEventListener (
54+ 'all-forms-open-for-registration' ,
55+ this . __boundDispatchRegistration ,
56+ ) ;
4757 }
4858
4959 _unregisterFormElement ( ) {
You can’t perform that action at this time.
0 commit comments