How to use the simple-html-tokenizer.TokenizerState.beforeAttributeValue function in simple-html-tokenizer

To help you get started, we’ve selected a few simple-html-tokenizer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glimmerjs / glimmer-vm / packages / @glimmer / syntax / lib / hbs / parse / html.ts View on Github external
appendNode(node: hbs.ConcatContent, source: string): void {
    switch (this.htmlParser.tokenizer.state) {
      case TokenizerState.attributeValueSingleQuoted:
      case TokenizerState.attributeValueDoubleQuoted: {
        assert(
          isAttrValue(node),
          `the right hand side of an attribute must be a valid attribute value (text, mustache or concat)`
        );
        this.element.appendStatementToAttributeValue(node, source);
        break;
      }

      case TokenizerState.beforeAttributeValue: {
        assert(
          isAttrValue(node),
          `the right hand side of an attribute must be a valid attribute value (text, mustache or concat)`
        );
        this.element.finalizeAttributeWithStatement(node, source);
        this.htmlParser.tokenizer.transitionTo(TokenizerState.afterAttributeValueQuoted);
        break;
      }
      default:
        this.parent.appendNode(node);
    }
  }