Skip to content

Commit 9135342

Browse files
committed
Change data handling
1 parent d98ba32 commit 9135342

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Compiler.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ public function registerData(DOMElement $scriptElement): void
502502
$content = $this->innerHtmlOfNode($scriptElement);
503503
if ($scriptElement->hasAttribute('lang') && $scriptElement->getAttribute('lang') === 'ts') {
504504
// TypeScript
505-
preg_match_all('/private\s+(\S+)\s*=\s*(.+?);\n/msi', $content, $matches, PREG_SET_ORDER);
505+
preg_match_all('/private\s+(\S+)\s*=\s*(.+?);\ *\n/msi', $content, $matches, PREG_SET_ORDER);
506506
foreach ($matches as $match) {
507507
$this->data[] = new Data(
508508
trim($match[1]),
@@ -525,14 +525,12 @@ public function registerData(DOMElement $scriptElement): void
525525
$char = mb_substr($dataString, $i, 1, 'UTF-8');
526526
$nextChar = mb_substr($dataString, $i + 1, 1, 'UTF-8');
527527
if ($char === '*' && $nextChar === '/') {
528-
$i += 2;
528+
++$i;
529529
$commentOpen = false;
530530
continue;
531531
}
532-
if ($char === '/' && $nextChar === '*') {
532+
if (($char === '/' && $nextChar === '*') || $commentOpen) {
533533
$commentOpen = true;
534-
}
535-
if ($commentOpen) {
536534
continue;
537535
}
538536
if ($quoteChar === null && ($char === '"' || $char === '\'')) {

0 commit comments

Comments
 (0)