@@ -38,33 +38,56 @@ export default Base.extend({
3838
3939 this . all_selects = dom . find_scoped ( this . el , this . options . select ) ;
4040 for ( const btn of this . all_selects ) {
41- btn . addEventListener ( "click" , this . select_all . bind ( this ) ) ;
41+ events . add_event_listener (
42+ btn ,
43+ "click" ,
44+ "pat-checklist--select-all--click" ,
45+ this . select_all . bind ( this )
46+ ) ;
4247 }
4348
4449 this . all_deselects = dom . find_scoped ( this . el , this . options . deselect ) ;
4550 for ( const btn of this . all_deselects ) {
46- btn . addEventListener ( "click" , this . deselect_all . bind ( this ) ) ;
51+ events . add_event_listener (
52+ btn ,
53+ "click" ,
54+ "pat-checklist--deselect-all--click" ,
55+ this . deselect_all . bind ( this )
56+ ) ;
4757 }
4858
4959 this . all_toggles = dom . find_scoped ( this . el , this . options . toggle ) ;
5060 for ( const btn of this . all_toggles ) {
51- btn . addEventListener ( "click" , this . toggle_all . bind ( this ) ) ;
61+ events . add_event_listener (
62+ btn ,
63+ "click" ,
64+ "pat-checklist--toggle-all--click" ,
65+ this . toggle_all . bind ( this )
66+ ) ;
5267 }
5368
5469 // update select/deselect button status
5570 this . change_buttons_and_toggles ( ) ;
5671 this . change_checked ( ) ;
57- this . el . addEventListener ( "change" , this . change_handler . bind ( this ) ) ;
72+ events . add_event_listener (
73+ this . el ,
74+ "change" ,
75+ "pat-checklist--change-handler--change" ,
76+ this . change_handler . bind ( this )
77+ ) ;
5878 } ,
5979
6080 destroy ( ) {
6181 for ( const it of this . all_selects ) {
62- it . removeEventListener ( " click", this . select_all ) ;
82+ events . remove_event_listener ( it , "pat-checklist--select-all-- click") ;
6383 }
6484 for ( const it of this . all_deselects ) {
65- it . removeEventListener ( "click" , this . deselect_all ) ;
85+ events . remove_event_listener ( it , "pat-checklist--deselect-all--click" ) ;
86+ }
87+ for ( const it of this . all_toggles ) {
88+ events . remove_event_listener ( it , "pat-checklist--toggle-all--click" ) ;
6689 }
67- this . el . removeEventListener ( " change" , this . change_handler ) ;
90+ events . remove_event_listener ( this . el , "pat-checklist-- change-handler--change" ) ;
6891 this . $el . off ( "patterns_injected" ) ;
6992 } ,
7093
0 commit comments