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

Extra space when using annonymous component #35866

Closed
fcno opened this issue Jan 13, 2021 · 4 comments · Fixed by #35874
Closed

Extra space when using annonymous component #35866

fcno opened this issue Jan 13, 2021 · 4 comments · Fixed by #35874

Comments

@fcno
Copy link

fcno commented Jan 13, 2021

  • Laravel Version: 8.22.0
  • PHP Version: 7.4.9
  • Database Driver & Version: none

Description:

Laravel Blade add extra space when using anonymous component.

Steps To Reproduce:

  1. create a annonymous component at laravel component default directory;
//link.blade.php
@props(['href'])

<a class="underline text-green-500 hover:text-green-700 focus:text-green-700" href="{{ $href }}">{{ $slot }}</a>
  1. Use the component in a paragraph in any view.
    <p class="py-1">I'm in love with <x-link href="https://laravel.com/docs/8.x">LARAVEL</x-link>.</p>

  2. A extra space will appear (from where? That's why I think its a bug) between the word LARAVEL and the dot at the end of the sentence.

@taylorotwell
Copy link
Member

Well, there is a line break within your component that you pasted?

@fcno
Copy link
Author

fcno commented Jan 13, 2021

Hi Taylor.
There is not a line breaker.
Let's say, its the full component.

To be more clear:
If there is a space in the text after the use of the component, the extra space will not be added. Its only happen, if there is no wrhite space after it.

Ex01: <p class="py-1"> Some text <x-link href="https://laravel.com/docs/8.x">LARAVEL</x-link> and this work.</p>
Ex02: <p class="py-1"> Some text <x-link href="https://laravel.com/docs/8.x">LARAVEL</x-link>, but this does not work.</p>

In exemple 02, the text will be render as "Some text LARAVEL , but this does not work".

Notice that there will be a extra space between LARAVEL and the comma.

@taylorotwell
Copy link
Member

Opened a PR to address the issue. Can you please take a look?

@fcno
Copy link
Author

fcno commented Jan 13, 2021

Yes I can.
But as I'm not good enough on read the code yet, there is not much that I can do besides post the bug I have found.

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

Successfully merging a pull request may close this issue.

2 participants