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
base: master
from

Conversation

Projects
None yet
4 participants
@airhadoken
Contributor

airhadoken commented Mar 10, 2013

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

This comment has been minimized.

Show comment
Hide comment
@bmomberger-reciprocity

bmomberger-reciprocity Mar 15, 2013

Contributor

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

Contributor

bmomberger-reciprocity commented Mar 15, 2013

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

Merge pull request #329 from bitovi/mustache-null-sections-307
Null objects within observes weren't working properly with Mustache sections #307
@andykant

This comment has been minimized.

Show comment
Hide comment
@andykant

andykant Mar 21, 2013

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

Contributor

andykant commented Mar 21, 2013

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

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Apr 16, 2013

Contributor

Seems to be good now I think.

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