create-prisma-php-app 3.0.0-beta.2 → 3.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -121,21 +121,6 @@ class PHPX implements IPHPX
|
|
|
121
121
|
array_flip(array_merge($reserved, $exclude))
|
|
122
122
|
);
|
|
123
123
|
|
|
124
|
-
$props = array_combine(
|
|
125
|
-
array_map('strtolower', array_keys($props)),
|
|
126
|
-
$props
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
foreach ($props as $key => $val) {
|
|
130
|
-
if (str_starts_with($key, 'on')) {
|
|
131
|
-
$event = substr($key, 2);
|
|
132
|
-
if (in_array($event, PrismaPHPSettings::$htmlEvents, true) && trim((string)$val) !== '') {
|
|
133
|
-
$props["pp-original-on{$event}"] = (string)$val;
|
|
134
|
-
}
|
|
135
|
-
unset($props[$key]);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
124
|
foreach ($params as $k => $v) {
|
|
140
125
|
$props[$k] = $v;
|
|
141
126
|
}
|
|
@@ -283,6 +283,7 @@ class TemplateCompiler
|
|
|
283
283
|
string $componentName,
|
|
284
284
|
array $incomingProps
|
|
285
285
|
): string {
|
|
286
|
+
$incomingProps = self::sanitizeIncomingProps($incomingProps);
|
|
286
287
|
$mapping = self::selectComponentMapping($componentName);
|
|
287
288
|
$instance = self::initializeComponentInstance($mapping, $incomingProps);
|
|
288
289
|
|
|
@@ -381,6 +382,21 @@ class TemplateCompiler
|
|
|
381
382
|
return $htmlOut;
|
|
382
383
|
}
|
|
383
384
|
|
|
385
|
+
protected static function sanitizeIncomingProps(array $props): array
|
|
386
|
+
{
|
|
387
|
+
foreach ($props as $key => $val) {
|
|
388
|
+
if (str_starts_with($key, 'on')) {
|
|
389
|
+
$event = substr($key, 2);
|
|
390
|
+
if (in_array($event, PrismaPHPSettings::$htmlEvents, true) && trim((string)$val) !== '') {
|
|
391
|
+
$props["pp-original-on{$event}"] = (string)$val;
|
|
392
|
+
unset($props[$key]);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return $props;
|
|
398
|
+
}
|
|
399
|
+
|
|
384
400
|
protected static function sanitizeEventAttributes(string $html): string
|
|
385
401
|
{
|
|
386
402
|
$fragDom = TemplateCompiler::convertToXml($html, false);
|