Treat pattern attribute of form elements as JS context in Template v2

This commit is contained in:
Kijin Sung 2025-06-17 17:15:49 +09:00
parent 170aab3ca8
commit dd4d4fe979
2 changed files with 9 additions and 1 deletions

View file

@ -185,7 +185,7 @@ class TemplateParser_v2
}, $content);
// Inline scripts.
$content = preg_replace_callback('#(?<=\s)(href="javascript:|on[a-z]+=")([^"]*?)"#i', function($match) {
$content = preg_replace_callback('#(?<=\s)(href="javascript:|pattern="|on[a-z]+=")([^"]*?)"#i', function($match) {
return $match[1] . '<?php $this->config->context = \'JS\'; ?>' . $match[2] . '<?php $this->config->context = \'HTML\'; ?>"';
}, $content);