-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Empty htmlSafe
string is treated as truthy
#17486
Comments
Empty arrays are a falsey value in Handlebars across the board ( see https://handlebarsjs.com/builtin_helpers.html for example). I haven’t really thought much about the empty safe string scenario though. I’d have to check what Handlebars does there... |
Sure! Sorry for not expressing myself clearly enough. 😊 I know that I brought it up because there where this exception is implemented, we could also implement the exception for empty |
@buschtoens |
I think this is probably a bug. (not sure what's up with that indentation) |
This does seem like a bug, |
If anyone is interested in working on a fix, I believe adding a case to the function I linked above should fix it. |
The
{{if}}
(and{{unless}}
,{{with}}
) template helpers treat an emptyhtmlSafe
string as truthy, while an empty string is treated as falsy and even an empty array is treated as falsy.Ember Twiddle
Interestingly I do not understand why an empty array is treated as falsy, when looking at the code:
ember.js/packages/@ember/-internals/glimmer/lib/helpers/if-unless.ts
Lines 41 to 47 in 1bea9af
The text was updated successfully, but these errors were encountered: