Skip to content

Commit

Permalink
fix: add ? check and change to const
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Thulin committed Dec 14, 2023
1 parent 5197b46 commit 99bdcf9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/php/Component/Iframe/iframe.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
@if($isSameTopDomain)
<script>
const acceptance = document.querySelector('#acceptance-{{$id}}');
const iframe = acceptance.querySelector('#{{$id}}');
const iframe = acceptance?.querySelector('#{{$id}}');
if(iframe) {
iframe.onload = function() {
let targetHeight = iframe.contentWindow.document.body.scrollHeight + 'px' ?? 'auto';
const targetHeight = iframe.contentWindow.document.body.scrollHeight + 'px' ?? 'auto';
acceptance.style.height = targetHeight;
iframe.style.height = targetHeight;
}
Expand Down

0 comments on commit 99bdcf9

Please sign in to comment.