@@ -270,7 +270,7 @@ export class Html5QrcodeScanner {
270270 if ( ! container ) {
271271 throw `HTML Element with id=${ this . elementId } not found` ;
272272 }
273- container . innerHTML = "" ;
273+ container . textContent = "" ;
274274 this . createBasicLayout ( container ! ) ;
275275 this . html5Qrcode = new Html5Qrcode (
276276 this . getScanRegionId ( ) ,
@@ -334,7 +334,7 @@ export class Html5QrcodeScanner {
334334 const emptyHtmlContainer = ( ) => {
335335 const mainContainer = document . getElementById ( this . elementId ) ;
336336 if ( mainContainer ) {
337- mainContainer . innerHTML = "" ;
337+ mainContainer . textContent = "" ;
338338 this . resetBasicLayout ( mainContainer ) ;
339339 }
340340 }
@@ -1044,15 +1044,15 @@ export class Html5QrcodeScanner {
10441044 this . getScanRegionId ( ) ) ! ;
10451045
10461046 if ( this . cameraScanImage ) {
1047- qrCodeScanRegion . innerHTML = "<br>" ;
1048- qrCodeScanRegion . appendChild ( this . cameraScanImage ) ;
1047+ const br = document . createElement ( "br" ) ;
1048+ qrCodeScanRegion . replaceChildren ( br , this . cameraScanImage ) ;
10491049 return ;
10501050 }
10511051
10521052 this . cameraScanImage = new Image ;
10531053 this . cameraScanImage . onload = ( _ ) => {
1054- qrCodeScanRegion . innerHTML = "<br>" ;
1055- qrCodeScanRegion . appendChild ( $this . cameraScanImage ! ) ;
1054+ const br = document . createElement ( "br" ) ;
1055+ qrCodeScanRegion . replaceChildren ( br , $this . cameraScanImage ! ) ;
10561056 }
10571057 this . cameraScanImage . width = 64 ;
10581058 this . cameraScanImage . style . opacity = "0.8" ;
@@ -1066,15 +1066,15 @@ export class Html5QrcodeScanner {
10661066 this . getScanRegionId ( ) ) ! ;
10671067
10681068 if ( this . fileScanImage ) {
1069- qrCodeScanRegion . innerHTML = "<br>" ;
1070- qrCodeScanRegion . appendChild ( this . fileScanImage ) ;
1069+ const br = document . createElement ( "br" ) ;
1070+ qrCodeScanRegion . replaceChildren ( br , this . fileScanImage ) ;
10711071 return ;
10721072 }
10731073
10741074 this . fileScanImage = new Image ;
10751075 this . fileScanImage . onload = ( _ ) => {
1076- qrCodeScanRegion . innerHTML = "<br>" ;
1077- qrCodeScanRegion . appendChild ( $this . fileScanImage ! ) ;
1076+ const br = document . createElement ( "br" ) ;
1077+ qrCodeScanRegion . replaceChildren ( br , $this . fileScanImage ! ) ;
10781078 }
10791079 this . fileScanImage . width = 64 ;
10801080 this . fileScanImage . style . opacity = "0.8" ;
@@ -1085,7 +1085,7 @@ export class Html5QrcodeScanner {
10851085 private clearScanRegion ( ) {
10861086 const qrCodeScanRegion = document . getElementById (
10871087 this . getScanRegionId ( ) ) ! ;
1088- qrCodeScanRegion . innerHTML = "" ;
1088+ qrCodeScanRegion . textContent = "" ;
10891089 }
10901090
10911091 //#region state getters
0 commit comments