Skip to content

Commit 2d92077

Browse files
Merge pull request #59 from gtko/fix/update-regex-js-script-tag
fix(js-regex): 🐛 Fix Regex Pattern in addScripts Method
2 parents b1eeaa8 + 3e138df commit 2d92077

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

resources/js/Cookies.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ class LaravelCookieConsent {
3232
}
3333

3434
addScripts(data) {
35-
if(!data.scripts) {
35+
if (!data.scripts) {
3636
return;
3737
}
3838

3939
data.scripts.forEach(script => {
40-
const scriptRegex = /<script.*<\/script>/;
40+
const scriptRegex = /<script[^]*<\/script>/;
4141
if (!scriptRegex.test(script)) {
4242
console.error('Invalid script tag: ' + script);
4343
}
@@ -56,7 +56,7 @@ class LaravelCookieConsent {
5656
}
5757

5858
addNotice(data) {
59-
if(!data.notice) {
59+
if (!data.notice) {
6060
return;
6161
}
6262

@@ -68,7 +68,7 @@ class LaravelCookieConsent {
6868

6969
let tags = tmp.querySelectorAll('[data-cookie-consent]');
7070

71-
if (! tags.length) {
71+
if (!tags.length) {
7272
return;
7373
}
7474

@@ -85,5 +85,5 @@ class LaravelCookieConsent {
8585
}
8686

8787
window.addEventListener('load', () => {
88-
window.LaravelCookieConsent = new LaravelCookieConsent({config:1});
88+
window.LaravelCookieConsent = new LaravelCookieConsent({ config: 1 });
8989
});

0 commit comments

Comments
 (0)