BladeOne icon indicating copy to clipboard operation
BladeOne copied to clipboard

x-component does not work with parameters that contain uppercase letters

Open nodesiremonk opened this issue 1 year ago • 1 comments

It seems the parseParams() function only match lowercases (a-z). So any camelCase keys are not working correctly. e.g.

<x-componet one="value1" twoWord="value2">slot</x-component> only pass $one (not $twoWord) to the component.

Is it possible to include A-Z in the preg_match_all() function to make it work with keys containing uppercase letters?

protected function parseParams($params): string
{
    preg_match_all('/([a-z-0-9:]*?)\s*?=\s*?(.+?)(\s|$)/ms', $params, $matches);
    // ...
}

nodesiremonk avatar Oct 10 '24 04:10 nodesiremonk

I tried to add the A-Z to the regex and it seems work for now.

preg_match_all('/([a-zA-Z0-9:-]*?)\s*?=\s*?(.+?)(\s|$)/ms', $params, $matches);

nodesiremonk avatar Oct 10 '24 19:10 nodesiremonk

I would also include allowing a "_" and "." as they are also valid characters within an attribute name: preg_match_all('/([0-9:._-]*?)\s*?=\s*?(.+?)(\s|$)/ms', $params, $matches);

AzzaAzza69 avatar Jul 06 '25 11:07 AzzaAzza69