File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed
src/BootstrapBlazor/Components/Mask Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change 11export function update ( id , options ) {
22 const mask = document . getElementById ( id ) ;
33 if ( mask ) {
4- const { show, containerId } = options ;
4+ const { show } = options ;
55 const el = document . querySelector ( `[data-bb-mask="${ id } "]` ) ;
6- if ( containerId ) {
7- const container = document . getElementById ( containerId ) ;
8- if ( container ) {
9- const position = container . style . getPropertyValue ( 'position' ) ;
10- if ( position === '' || position === 'static' ) {
11- container . style . setProperty ( 'position' , 'relative' ) ;
12- }
13-
14- if ( show ) {
15- el . style . setProperty ( '--bb-mask-position' , 'absolute' ) ;
16- container . appendChild ( el ) ;
17- }
6+ const container = getContainerBySelector ( options ) ;
7+ if ( container ) {
8+ const position = container . style . getPropertyValue ( 'position' ) ;
9+ if ( position === '' || position === 'static' ) {
10+ container . style . setProperty ( 'position' , 'relative' ) ;
11+ }
12+ if ( show ) {
13+ el . style . setProperty ( '--bb-mask-position' , 'absolute' ) ;
14+ container . appendChild ( el ) ;
1815 }
1916 }
2017 else {
3128 }
3229 }
3330}
31+
32+ const getContainerBySelector = options => {
33+ const selector = getContainerById ( options . containerId ) ?? options . selector ;
34+ return selector ? document . querySelector ( selector ) : null ;
35+ }
36+
37+ const getContainerById = id => id ? `#${ id } ` : null ;
You can’t perform that action at this time.
0 commit comments