title: ../this returns the view object inside inner loop when the parent and child have the same value
body: <p>I am just starting with <code>handlebars</code> and I am trying to do a simple double for loop in order to have all the day's time with 15 minute intervals. A very weird thing is happening where if the child and parent have the same values, the <code>view</code> object is being returned instead. This is my code:</p>
  
  <pre><code>var handlebarsExpress = require('express-handlebars').create({
      helpers: {
          for: function(from, to, incr, block) {
              var accum = '';
              for(var i = from; i &lt;= to; i += incr) {
                  accum += block.fn(i);
              }
              return accum;
          }
      }
  });
  
  app.engine('handlebars', handlebarsExpress.engine);
  app.set('view engine', 'handlebars');
  
  ...
  ...
  </code></pre>
  
  <p>In the view file (<code>sth.handlebars</code>) i have this:</p>
  
  <pre><code>&lt;div class="row columns large-12"&gt;
      {{#for 0 23 1}}
          {{#for 0 45 15}}
              {{log ../this}}
              &lt;span&gt;{{../this}}:{{this}}&lt;/span&gt;&lt;br&gt;
          {{/for}}
      {{/for}}
  &lt;/div&gt;
  </code></pre>
  
  <p>The html output is something like this:</p>
  
  <pre><code>[object Object]:0
  0:15
  0:30
  0:45
  1:0
  ...
  ...
  13:45
  14:0
  14:15
  14:30
  14:45
  15:0
  [object Object]:15
  15:30
  15:45
  16:0
  16:15
  </code></pre>
  
  <p>The <code>log</code> helper reports the following in the terminal:</p>
  
  <pre><code>{ settings: 
     { 'x-powered-by': true,
       etag: 'weak',
       'etag fn': [Function: wetag],
       env: 'development',
       'query parser': 'extended',
       'query parser fn': [Function: parseExtendedQueryString],
       'subdomain offset': 2,
       'trust proxy': false,
       'trust proxy fn': [Function: trustNone],
       view: [Function: View],
       views: '/home/elsa/Projects/rental-borg/project/views',
       'jsonp callback name': 'callback',
       'view engine': 'handlebars',
       port: 8765 },
    flash: { info: undefined, error: undefined },
    _locals: { flash: { info: undefined, error: undefined } },
    cache: false }
  0
  0
  0
  1
  1
  1
  1
  2
  2
  2
  2
  3
  3
  3
  3
  4
  ...
  ...
  13
  13
  13
  13
  14
  14
  14
  14
  15
  { settings: 
     { 'x-powered-by': true,
       etag: 'weak',
       'etag fn': [Function: wetag],
       env: 'development',
       'query parser': 'extended',
       'query parser fn': [Function: parseExtendedQueryString],
       'subdomain offset': 2,
       'trust proxy': false,
       'trust proxy fn': [Function: trustNone],
       view: [Function: View],
       views: '/home/elsa/Projects/rental-borg/project/views',
       'jsonp callback name': 'callback',
       'view engine': 'handlebars',
       port: 8765 },
    flash: { info: undefined, error: undefined },
    _locals: { flash: { info: undefined, error: undefined } },
    cache: false }
  15
  15
  16
  16
  16
  16
  ...
  23
  23
  23
  23
  </code></pre>
  
  <p>It is apparent that when <code>this</code> and <code>../this</code> are equal, <code>../this</code> actually returns something like <code>../../this</code> which is the view object itself, I suppose. This happens twice in my specific case, on 00:00 and on 15:15.</p>
  
  <p>Is this a bug?</p>
  
  <p>EDIT: I solved the problem with the new Block Parameters feature of Handlebars 3, but the initial question remains. This is what I did to solve the problem:</p>
  
  <p><code>.handlebars</code> file:</p>
  
  <pre><code>{{#for 0 23 1 as |hour|}}
      {{#for 0 45 15 as |minute|}}
          &lt;span&gt;{{hour}}:{{minute}}&lt;/span&gt;
      {{/for}}
  {{/for}}
  </code></pre>
  
  <p>and the helper:</p>
  
  <pre><code>for: function(from, to, incr, block) {
      var args = [], options = arguments[arguments.length - 1];
      for (var i = 0; i &lt; arguments.length - 1; i++) {
          args.push(arguments[i]);
      }
  
      var accum = '';
      for(var i = from; i &lt;= to; i += incr) {
          accum += options.fn(i, {data: options.data, blockParams: [i]});
      }
      return accum;
  },
  </code></pre>