spacebars-compiler.js
function (ttag, scanner) {

  if (ttag.type === 'INCLUSION' || ttag.type === 'BLOCKOPEN') {
    var args = ttag.args;
    if (ttag.path[0] === 'each' && args[1] && args[1][0] === 'PATH' &&
        args[1][1][0] === 'in') {
      // For slightly better error messages, we detect the each-in case
      // here in order not to complain if the user writes `{{#each 3 in x}}`
      // that "3 is not a function"
    } else {
      if (args.length > 1 && args[0].length === 2 && args[0][0] !== 'PATH') {
        // we have a positional argument that is not a PATH followed by
        // other arguments
        scanner.fatal("First argument must be a function, to be called on " +
                      "the rest of the arguments; found " + args[0][0]);
      }
    }
  }

  var position = ttag.position || TEMPLATE_TAG_POSITION.ELEMENT;
  if (position === TEMPLATE_TAG_POSITION.IN_ATTRIBUTE) {
    if (ttag.type === 'DOUBLE' || ttag.type === 'ESCAPE') {
      return;
    } else if (ttag.type === 'BLOCKOPEN') {
      var path = ttag.path;
      var path0 = path[0];
      if (! (path.length === 1 && (path0 === 'if' ||
                                   path0 === 'unless' ||
                                   path0 === 'with' ||
                                   path0 === 'each'))) {
        scanner.fatal("Custom block helpers are not allowed in an HTML attribute, only built-in ones like #each and #if");
      }
    } else {
      scanner.fatal(ttag.type + " template tag is not allowed in an HTML attribute");
    }
  } else if (position === TEMPLATE_TAG_POSITION.IN_START_TAG) {
    if (! (ttag.type === 'DOUBLE')) {
      scanner.fatal("Reactive HTML attributes must either have a constant name or consist of a single {{helper}} providing a dictionary of names and values.  A template tag of type " + ttag.type + " is not allowed here.");
    }
    if (scanner.peek() === '=') {
      scanner.fatal("Template tags are not allowed in attribute names, only in attribute values or in the form of a single {{helper}} that evaluates to a dictionary of name=value pairs.");
    }
  }

}
function (ttag, scanner) {

  if (ttag.type === 'INCLUSION' || ttag.type === 'BLOCKOPEN') {
    var args = ttag.args;
    if (ttag.path[0] === 'each' && args[1] && args[1][0] === 'PATH' &&
        args[1][1][0] === 'in') {
      // For slightly better error messages, we detect the each-in case
      // here in order not to complain if the user writes `{{#each 3 in x}}`
      // that "3 is not a function"
    } else {
      if (args.length > 1 && args[0].length === 2 && args[0][0] !== 'PATH') {
        // we have a positional argument that is not a PATH followed by
        // other arguments
        scanner.fatal("First argument must be a function, to be called on " +
                      "the rest of the arguments; found " + args[0][0]);
      }
    }
  }

  var position = ttag.position || TEMPLATE_TAG_POSITION.ELEMENT;
  if (position === TEMPLATE_TAG_POSITION.IN_ATTRIBUTE) {
    if (ttag.type === 'DOUBLE' || ttag.type === 'ESCAPE') {
      return;
    } else if (ttag.type === 'BLOCKOPEN') {
      var path = ttag.path;
      var path0 = path[0];
      if (! (path.length === 1 && (path0 === 'if' ||
                                   path0 === 'unless' ||
                                   path0 === 'with' ||
                                   path0 === 'each'))) {
        scanner.fatal("Custom block helpers are not allowed in an HTML attribute, only built-in ones like #each and #if");
      }
    } else {
      scanner.fatal(ttag.type + " template tag is not allowed in an HTML attribute");
    }
  } else if (position === TEMPLATE_TAG_POSITION.IN_START_TAG) {
    if (! (ttag.type === 'DOUBLE')) {
      scanner.fatal("Reactive HTML attributes must either have a constant name or consist of a single {{helper}} providing a dictionary of names and values.  A template tag of type " + ttag.type + " is not allowed here.");
    }
    if (scanner.peek() === '=') {
      scanner.fatal("Template tags are not allowed in attribute names, only in attribute values or in the form of a single {{helper}} that evaluates to a dictionary of name=value pairs.");
    }
  }

}
function ( ttag , scanner ) { if ( ttag . type === 'INCLUSION' || ttag . type === 'BLOCKOPEN' ) { var args = ttag . args ; if ( ttag . path [ 0 ] === 'each' && args [ 1 ] && args [ 1 ] [ 0 ] === 'PATH' && args [ 1 ] [ 1 ] [ 0 ] === 'in' ) { // For slightly better error messages, we detect the each-in case // here in order not to complain if the user writes `{{#each 3 in x}}` // that "3 is not a function" } else { if ( args . length > 1 && args [ 0 ] . length === 2 && args [ 0 ] [ 0 ] !== 'PATH' ) { // we have a positional argument that is not a PATH followed by // other arguments scanner . fatal ( "First argument must be a function, to be called on " + "the rest of the arguments; found " + args [ 0 ] [ 0 ] ) ; } } } var position = ttag . position || TEMPLATE_TAG_POSITION . ELEMENT ; if ( position === TEMPLATE_TAG_POSITION . IN_ATTRIBUTE ) { if ( ttag . type === 'DOUBLE' || ttag . type === 'ESCAPE' ) { return ; } else if ( ttag . type === 'BLOCKOPEN' ) { var path = ttag . path ; var path0 = path [ 0 ] ; if ( ! ( path . length === 1 && ( path0 === 'if' || path0 === 'unless' || path0 === 'with' || path0 === 'each' ) ) ) { scanner . fatal ( "Custom block helpers are not allowed in an HTML attribute, only built-in ones like #each and #if" ) ; } } else { scanner . fatal ( ttag . type + " template tag is not allowed in an HTML attribute" ) ; } } else if ( position === TEMPLATE_TAG_POSITION . IN_START_TAG ) { if ( ! ( ttag . type === 'DOUBLE' ) ) { scanner . fatal ( "Reactive HTML attributes must either have a constant name or consist of a single {{helper}} providing a dictionary of names and values.  A template tag of type " + ttag . type + " is not allowed here." ) ; } if ( scanner . peek ( ) === '=' ) { scanner . fatal ( "Template tags are not allowed in attribute names, only in attribute values or in the form of a single {{helper}} that evaluates to a dictionary of name=value pairs." ) ; } } }
Validate that `templateTag` is correctly formed and legal for its HTML position.  Use `scanner` to report errors. On success, does nothing.
Validate that templateTag is correctly formed and legal for its HTML position . Use scanner to report errors . On success does nothing .