Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: attributes that passed into custom components are dahes-trimmed #11

Closed
nael94 opened this issue Jul 27, 2024 · 1 comment
Closed

Comments

@nael94
Copy link

nael94 commented Jul 27, 2024

When passing attributes into the custom component, all dashes are trimmed like this:

[views/home.php]
<x-alert :data-id-user="5">
  Message
</x-alert>

This outputs:

<div dataiduser="5">
  Message
</div>
@nael94 nael94 changed the title Issue: feeding php variables or operation results in a component Issue: attributes that passed into custom components are dahes-trimmed Aug 10, 2024
nael94 added a commit to nael94/crow that referenced this issue Aug 10, 2024
… dashed attributes won't be camelCased anymore due to ability to user custom data attributes, also introduced $this->getAttributesParsed() passed through custom component by $attributesParsed.
@nael94
Copy link
Author

nael94 commented Aug 10, 2024

Okay I've solved this issue and did essential change in parsing attributes behavior: dashed attributes are no longer parsed to camelCase for using data-* attributes as well.

// [views/home.php]
@php
  $x = 5;
@endphp
<x-alert
  :data-id-user="$x"
>
  Message
</x-alert>

This will output:

<div data-id-user="5">
  Message
</div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant