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

Better handling of null values in Mustache sections. #307

Closed
wants to merge 1 commit into from

Conversation

airhadoken
Copy link
Contributor

While working on something completely different I found bad handling of null properties in objects, like this: http://jsfiddle.net/air_hadoken/w5NPK/2/

So this is somewhat better handling of null when rendering Mustaches; it's a bit closer to how undefined would be handled.

@bmomberger-reciprocity
Copy link
Contributor

This is more in line with mustache.js's null_string and null_view specs.

@ghost ghost assigned andykant Mar 15, 2013
andykant added a commit that referenced this pull request Mar 21, 2013
Null objects within observes weren't working properly with Mustache sections #307
@andykant
Copy link
Contributor

I merged portions of your pull request: The changes in Mustache.get and your test case with some minor tweaks to the template since it contained unsupported syntax ({{else}} within a base Mustache section).

I skipped the Mustache.txt changes as they seemed to primarily be for supporting the {{else}} within a base Mustache section ({{#foo.bar}} instead of the {{#if foo.bar}} helper variant). {{else}} is part of the helper extensions to Mustache and should only be used with helpers.

Currently, any template that isn't using helper enhancements should maintain compatibility with other Mustache libraries that implement the official spec.

I'm going to leave this pull request open for now in case anyone wants discuss this further.

/cc @justinbmeyer @daffl @moschel

@daffl
Copy link
Contributor

daffl commented Apr 16, 2013

Seems to be good now I think.

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 this pull request may close these issues.

None yet

4 participants