[13.x] Improved empty and whitespace-only string handling in Blade component attributes #57467
+25
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #57463
Related #31994
renders as
which is wrong. Title isn't a boolean attribute. It should be
We only ever want to have empty strings or whitespace-only strings in these situations:
altvaluedata-*Never for
title,rel,placeholder,classetc.Everything in our #57235 supi dupi mega thread points to that we want Laravel data attributes to be somewhat aligned with what Vue does (cc @timacdonald). So, if we want that, we should start here. Though, Vue doesn't allow
:title="item.value"so the exceptions I added only make sense but Vue doesn't have them. That said, given how Blade component attributes work, I believe we surely don't want to introduce a whole new defaults-concept in #57235, but mirror what we already have in Blade component attributes. Not sure if Tim agrees, but I believe consistency within the framework is more important than what Vue does (this is mainly about boolean behaviour) . So, if this is merged we have one thing less to worry about in the other PR.