Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9053507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:26:19+00:00 2026-06-16T13:26:19+00:00

According to the mustache RFC A {{name}} tag in a basic template will try

  • 0

According to the mustache RFC

A {{name}} tag in a basic template will try to find the name key in
the current context. If there is no name key, nothing will be
rendered.

I therefore expected this:

var template = '{{#anArray}}{{aString}}{{/anArray}}';

var json = {
    "aString":"ABC",
    "anArray": [1,{"aString":"DEF"}]
 };

To give me once rendered:

"DEF"

However mustache.js looks for values in the parent’s scope. Which gives me

"ABCDEF"

Do the context actually means including all the parents scopes ?

http://jsfiddle.net/ZG4zd/20/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:26:22+00:00Added an answer on June 16, 2026 at 1:26 pm

    Short answer: yes.

    A bit longer answer. Context.prototype.lookup does a while loop, looking up a token in current context and it’s parent contexts, while there is a parent context.

    Relevant bit of code:

    Context.prototype.lookup = function (name) {
        var value = this._cache[name];
    
        if (!value) {
          if (name === ".") {
            value = this.view;
          } else {
            var context = this;
    
            //Iterate ancestor contexts
            while (context) {
              if (name.indexOf(".") > 0) {
                var names = name.split("."), i = 0;
    
                value = context.view;
    
                while (value && i < names.length) {
                  value = value[names[i++]];
                }
              } else {
                value = context.view[name];
              }
    
              if (value != null) {
                break;
              }
    
    
              context = context.parent;
            }
          }
    
          this._cache[name] = value;
        }
    
        if (typeof value === "function") {
          value = value.call(this.view);
        }
    
        return value;
      };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to PHP.net manual, pg_pconnect will create a persistent connection, or will return the
According to the following URL, there are three versions of the Entity Framework Storage
According to the explanation of this site don't use system(pause) , system(pause) will open
according to the twitter api documentation http://dev.twitter.com/doc/get/statuses/user_timeline accessing the current logged in users timeline
According to this question , I should try to use Preallocation is Matlab. Now
According to php.net, Stack Overflow and other sources of trust, I can find 4
According to the Android docs Intent extra name must have a package prefix. I've
According to the answers in this comparison question , there's no technical difference between
According to Josh Bloch in Java: There is no way to extend an instantiable
According to the introduction about ReaderT , I can only find: ReaderT Env IO

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.