Skip to content

Blade Component Attributes should not render when empty/whitespace-only #57463

@NickSdot

Description

@NickSdot

Laravel Version

12

PHP Version

8.4

Database Driver & Version

No response

Description

While discussing #57235 I found that

 @php($foo = "")
 <x-link :title="$foo" >

renders as

<a title>

Personally, I believe that this is unexpected and that empty strings and whitespace-only strings should not render the attribute.

Opinions? Do we have any appetite to change this in L13?

Steps To Reproduce

Component:

<a {{ $attributes }}>Blub</a>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions