code: function (scanner, quote) {
    if (quote) {
      if (scanner.peek() !== quote)
        return null;
      scanner.pos++;
    }
  
    var tokens = [];
    var charsTokenToExtend = null;
  
    var charRef;
    while (true) {
      var ch = scanner.peek();
      var templateTag;
      var curPos = scanner.pos;
      if (quote && ch === quote) {
        scanner.pos++;
        return tokens;
      } else if ((! quote) && (HTML_SPACE.test(ch) || ch === '>')) {
        return tokens;
      } else if (! ch) {
        scanner.fatal("Unclosed attribute in tag");
      } else if (quote ? ch === '\u0000' : ('\u0000"\'<=`'.indexOf(ch) >= 0)) {
        scanner.fatal("Unexpected character in attribute value");
      } else if (ch === '&' &&
                 (charRef = getCharacterReference(scanner, true,
                                                  quote || '>'))) {
        tokens.push(charRef);
        charsTokenToExtend = null;
      } else if (scanner.getTemplateTag &&
                 ((templateTag = scanner.getTemplateTag(
                   scanner, TEMPLATE_TAG_POSITION.IN_ATTRIBUTE)) ||
                  scanner.pos > curPos /* `{{! comment}}` */)) {
        if (templateTag) {
          tokens.push({t: 'TemplateTag',
                       v: assertIsTemplateTag(templateTag)});
          charsTokenToExtend = null;
        }
      } else {
        if (! charsTokenToExtend) {
          charsTokenToExtend = { t: 'Chars', v: '' };
          tokens.push(charsTokenToExtend);
        }
        charsTokenToExtend.v += (ch === '\r' ? '\n' : ch);
        scanner.pos++;
        if (quote && ch === '\r' && scanner.peek() === '\n')
          scanner.pos++;
      }
    }
  }
docs: Scan a quoted or unquoted attribute value (omit `quote` for unquoted).