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

Fixed #801 #815

Merged
merged 3 commits into from Mar 15, 2013
Merged

Fixed #801 #815

merged 3 commits into from Mar 15, 2013

Conversation

@raix
Copy link
Contributor

@raix raix commented Mar 14, 2013

{{#each}} broke when iterating over null eg. [1, 2, null] - evaluate.js->each tried getting property ._id from null.

@Tarang
Copy link
Contributor

@Tarang Tarang commented Mar 14, 2013

Would this work, if I ran the below in my js console

(thisvar && thisvar.subvar)

I would get an error (thisvar not being defined)

So with an array like this:

["a","b",undefined]

it would still be a problem

I think it needs to check if x exists first, then check continue to the next step (this way null and undefined and edge cases are taken care of i.e. I don't think using if(x) can be used because then 0 & false would be issues

(x==null) should take care of undefined too

var branch = null;
if(!x==null) var branch = ((x._id && x) || (typeof x === 'string' ? x : null) ||
                       Spark.UNIQUE_LABEL);
@raix
Copy link
Contributor Author

@raix raix commented Mar 14, 2013

Yep, it works even if undefined - I think the test in your browser lacks the existens of thisvar - theres no memory allocated - in evaluate.js the x is handed as a function parametre, therefore it exists, but could be a falsy

In console try:

    var foo; //foo is undefined but it exists
    if (foo) { console.log('true'); } else { console.log('false');}
raix added 2 commits Mar 14, 2013
Mentioned by Chris Mather on google talk
cmather added a commit that referenced this pull request Mar 15, 2013
@cmather cmather merged commit 0ead1fb into meteor:devel Mar 15, 2013
@raix
Copy link
Contributor Author

@raix raix commented Mar 15, 2013

Thanks, close #801 ? :)

@cmather
Copy link
Contributor

@cmather cmather commented Mar 15, 2013

On it :-)

@cmather
Copy link
Contributor

@cmather cmather commented Mar 15, 2013

Thanks @raix!

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

Successfully merging this pull request may close these issues.

None yet

3 participants