File tree Expand file tree Collapse file tree 1 file changed +17
-14
lines changed
src/BootstrapBlazor.Server/Components/Components Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Original file line number Diff line number Diff line change 1- import { insertAfter } from "../../_content/BootstrapBlazor/modules/utility.js"
2- import Data from "../../_content/BootstrapBlazor/modules/data.js"
3- import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js"
1+ import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js"
42
53export function init ( id ) {
6- const el = document . getElementById ( id )
4+ const el = document . getElementById ( id ) ;
75 if ( el === null ) {
8- return
6+ return ;
97 }
10- const themeList = el . querySelector ( '.theme-list' )
11-
12- Data . set ( id , { el } ) ;
138
9+ const themeList = document . querySelector ( '.theme-list' ) ;
10+ const close = document . querySelector ( '.theme-list .btn-close' ) ;
1411 EventHandler . on ( el , 'click' , ( ) => {
15- themeList . classList . toggle ( 'is-open' )
16- } )
12+ themeList . classList . toggle ( 'is-open' ) ;
13+ } ) ;
14+ EventHandler . on ( close , 'click' , ( ) => {
15+ themeList . classList . remove ( 'is-open' ) ;
16+ } ) ;
1717}
1818
1919export function dispose ( id ) {
20- const theme = Data . get ( id )
21- Data . remove ( id )
20+ const el = document . getElementById ( id ) ;
21+ if ( el ) {
22+ EventHandler . off ( el , 'click' ) ;
23+ }
2224
23- if ( theme ) {
24- EventHandler . off ( theme . el , 'click' )
25+ const close = document . querySelector ( '.theme-list .btn-close' ) ;
26+ if ( close ) {
27+ EventHandler . off ( close , 'click' ) ;
2528 }
2629}
You can’t perform that action at this time.
0 commit comments