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

Inverse ^if doesn't work correctly with an else #751

Closed
matthewp opened this Issue Feb 20, 2014 · 3 comments

Comments

Projects
None yet
4 participants
@matthewp
Contributor

matthewp commented Feb 20, 2014

The inverse if is not documented so I'm not sure if this is really a bug but here is a fiddle.

Problems in the fiddle:

  • When falsey it shows the inverse section.
  • When truthy it shows nothing.

VOTE HERE: http://bithub.com/event/30947

@daffl daffl added this to the 2.0.6 milestone Feb 20, 2014

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Feb 21, 2014

Contributor

Yeah, I noticed this when implementing stash.

Sent from my iPhone

On Feb 20, 2014, at 3:22 PM, Matthew Phillips notifications@github.com wrote:

The inverse if is not documented so I'm not sure if this is really a bug but here is a fiddle.

Problems in the fiddle:

When falsey it shows the inverse section.
When truthy it shows nothing.

Reply to this email directly or view it on GitHub.

Contributor

justinbmeyer commented Feb 21, 2014

Yeah, I noticed this when implementing stash.

Sent from my iPhone

On Feb 20, 2014, at 3:22 PM, Matthew Phillips notifications@github.com wrote:

The inverse if is not documented so I'm not sure if this is really a bug but here is a fiddle.

Problems in the fiddle:

When falsey it shows the inverse section.
When truthy it shows nothing.

Reply to this email directly or view it on GitHub.

@daffl daffl added the Bug label Feb 26, 2014

@matthewp

This comment has been minimized.

Show comment
Hide comment
@matthewp

matthewp Feb 28, 2014

Contributor

Problem is it generates 2 inverse functions. Not sure what the correct way to fix this is. Should this be "corrected" just before it's handed off to the helper?

            {inverse: function(scope, options) {
                    var ___v1ew = [];
                    ___v1ew.push(
                    "<div>Not showing</div>");
                    return ___v1ew.join("");
                }}, 
            {inverse: function(scope, options) {
                    var ___v1ew = [];
                    ___v1ew.push(
                    "<div>Is showing</div>");
                    return ___v1ew.join("");
                }}
Contributor

matthewp commented Feb 28, 2014

Problem is it generates 2 inverse functions. Not sure what the correct way to fix this is. Should this be "corrected" just before it's handed off to the helper?

            {inverse: function(scope, options) {
                    var ___v1ew = [];
                    ___v1ew.push(
                    "<div>Not showing</div>");
                    return ___v1ew.join("");
                }}, 
            {inverse: function(scope, options) {
                    var ___v1ew = [];
                    ___v1ew.push(
                    "<div>Is showing</div>");
                    return ___v1ew.join("");
                }}

matthewp added a commit to matthewp/canjs that referenced this issue Feb 28, 2014

@daffl daffl modified the milestones: 2.1.0, 2.0.6 Mar 13, 2014

@alexisabril

This comment has been minimized.

Show comment
Hide comment
@alexisabril

alexisabril Apr 2, 2014

Contributor

Note: Pull #759 from @matthewp into minor prior to #859 as one is the fix, one is the test.

Contributor

alexisabril commented Apr 2, 2014

Note: Pull #759 from @matthewp into minor prior to #859 as one is the fix, one is the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment