Skip to content

Commit c046911

Browse files
authored
Wrap script into IIFE to avoid variable naming conflicts
1 parent 3c11857 commit c046911

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/DateTimePicker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private function getScript(): string
9595
$config = json_encode($this->config, JSON_THROW_ON_ERROR);
9696

9797
return <<<JS
98-
const htmlElement = document.querySelector('html');
98+
(function(){const htmlElement = document.querySelector('html');
9999
let theme = htmlElement.getAttribute('data-bs-theme');
100100
101101
const config = JSON.parse('$config');
@@ -119,7 +119,7 @@ private function getScript(): string
119119
};
120120
}
121121
122-
$("#$this->id").tempusDominus(config);
122+
$("#$this->id").tempusDominus(config);})()
123123
JS;
124124
}
125125

0 commit comments

Comments
 (0)