File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
src/BootstrapBlazor/Components/Watermark Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,12 @@ export function dispose(id) {
4141 Data . remove ( id ) ;
4242
4343 if ( watermark ) {
44- const { ob } = watermark ;
44+ const { el , ob } = watermark ;
4545 ob . disconnect ( ) ;
4646
4747 delete watermark . ob ;
48+ document . body . removeAttribute ( 'data-bb-watermark' ) ;
49+ el . remove ( ) ;
4850 }
4951}
5052
@@ -102,13 +104,13 @@ const createWatermark = watermark => {
102104 if ( mark ) {
103105 mark . remove ( ) ;
104106 }
107+ el . appendChild ( div ) ;
105108
106- if ( bg . isPage ) {
107- document . body . appendChild ( div ) ;
108- }
109- else {
110- el . appendChild ( div ) ;
109+ if ( options . isPage ) {
110+ document . body . setAttribute ( 'data-bb-watermark' , "true" ) ;
111+ document . body . appendChild ( el ) ;
111112 }
113+
112114 options . bg = bg ;
113115 requestAnimationFrame ( ( ) => monitor ( watermark ) ) ;
114116}
@@ -179,8 +181,12 @@ const monitor = watermark => {
179181
180182const clearWatermark = watermark => {
181183 const { el, ob } = watermark ;
182- ob . disconnect ( ) ;
183- el . innerHTML = '' ;
184+ if ( ob ) {
185+ ob . disconnect ( ) ;
186+ }
187+ if ( el ) {
188+ el . innerHTML = '' ;
189+ }
184190}
185191
186192const getWatermark = props => {
You can’t perform that action at this time.
0 commit comments