@@ -272,7 +272,7 @@ export class Html5QrcodeScanner {
272272 if ( ! container ) {
273273 throw `HTML Element with id=${ this . elementId } not found` ;
274274 }
275- container . innerHTML = "" ;
275+ container . textContent = "" ;
276276 this . createBasicLayout ( container ! ) ;
277277 this . html5Qrcode = new Html5Qrcode (
278278 this . getScanRegionId ( ) ,
@@ -336,7 +336,7 @@ export class Html5QrcodeScanner {
336336 const emptyHtmlContainer = ( ) => {
337337 const mainContainer = document . getElementById ( this . elementId ) ;
338338 if ( mainContainer ) {
339- mainContainer . innerHTML = "" ;
339+ mainContainer . textContent = "" ;
340340 this . resetBasicLayout ( mainContainer ) ;
341341 }
342342 }
@@ -1047,15 +1047,15 @@ export class Html5QrcodeScanner {
10471047 this . getScanRegionId ( ) ) ! ;
10481048
10491049 if ( this . cameraScanImage ) {
1050- qrCodeScanRegion . innerHTML = "<br>" ;
1051- qrCodeScanRegion . appendChild ( this . cameraScanImage ) ;
1050+ const br = document . createElement ( "br" ) ;
1051+ qrCodeScanRegion . replaceChildren ( br , this . cameraScanImage ) ;
10521052 return ;
10531053 }
10541054
10551055 this . cameraScanImage = new Image ;
10561056 this . cameraScanImage . onload = ( _ ) => {
1057- qrCodeScanRegion . innerHTML = "<br>" ;
1058- qrCodeScanRegion . appendChild ( $this . cameraScanImage ! ) ;
1057+ const br = document . createElement ( "br" ) ;
1058+ qrCodeScanRegion . replaceChildren ( br , $this . cameraScanImage ! ) ;
10591059 }
10601060 this . cameraScanImage . width = 64 ;
10611061 this . cameraScanImage . style . opacity = "0.8" ;
@@ -1069,15 +1069,15 @@ export class Html5QrcodeScanner {
10691069 this . getScanRegionId ( ) ) ! ;
10701070
10711071 if ( this . fileScanImage ) {
1072- qrCodeScanRegion . innerHTML = "<br>" ;
1073- qrCodeScanRegion . appendChild ( this . fileScanImage ) ;
1072+ const br = document . createElement ( "br" ) ;
1073+ qrCodeScanRegion . replaceChildren ( br , this . fileScanImage ) ;
10741074 return ;
10751075 }
10761076
10771077 this . fileScanImage = new Image ;
10781078 this . fileScanImage . onload = ( _ ) => {
1079- qrCodeScanRegion . innerHTML = "<br>" ;
1080- qrCodeScanRegion . appendChild ( $this . fileScanImage ! ) ;
1079+ const br = document . createElement ( "br" ) ;
1080+ qrCodeScanRegion . replaceChildren ( br , $this . fileScanImage ! ) ;
10811081 }
10821082 this . fileScanImage . width = 64 ;
10831083 this . fileScanImage . style . opacity = "0.8" ;
@@ -1088,7 +1088,7 @@ export class Html5QrcodeScanner {
10881088 private clearScanRegion ( ) {
10891089 const qrCodeScanRegion = document . getElementById (
10901090 this . getScanRegionId ( ) ) ! ;
1091- qrCodeScanRegion . innerHTML = "" ;
1091+ qrCodeScanRegion . textContent = "" ;
10921092 }
10931093
10941094 //#region state getters
0 commit comments