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

Strict mode errors on unless block with nested property #1138

Open
GriffinSauce opened this issue Nov 27, 2015 · 1 comment
Open

Strict mode errors on unless block with nested property #1138

GriffinSauce opened this issue Nov 27, 2015 · 1 comment
Labels
Milestone

Comments

@GriffinSauce
Copy link

When strict: true is added Handlebars errors on the use of a missing nested property in an unless block helper.

var myObject = {};
{{#unless myObject}}

{{/unless}}
-> no error

{{#unless myObject.prop.prop}}

{{/unless}}
-> error "prop doesn't exist"

As described in this issue strict mode shouldn't be enforced on helpers and conditional block. The point of a conditional block is to handle (non-)existence of properties.

@kpdecker
Copy link
Collaborator

Right now arguments are basically treated the same was as assumeObjects mode for strict mode. It doesn't seem out of line to change this to perform normal object existence checks (which come at the expense of a larger codebase).

If strict mode is defined and assumeObjects is not, then we should do the existence check for arg and hash lookups. If assumeObjects is set, then it should throw as it does today.

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

No branches or pull requests

2 participants