* Convert HTML string to AST.
( template, options )
| 7693 | * Convert HTML string to AST. |
| 7694 | */ |
| 7695 | function parse ( |
| 7696 | template, |
| 7697 | options |
| 7698 | ) { |
| 7699 | warn$2 = options.warn || baseWarn; |
| 7700 | platformGetTagNamespace = options.getTagNamespace || no; |
| 7701 | platformMustUseProp = options.mustUseProp || no; |
| 7702 | platformIsPreTag = options.isPreTag || no; |
| 7703 | preTransforms = pluckModuleFunction(options.modules, 'preTransformNode'); |
| 7704 | transforms = pluckModuleFunction(options.modules, 'transformNode'); |
| 7705 | postTransforms = pluckModuleFunction(options.modules, 'postTransformNode'); |
| 7706 | delimiters = options.delimiters; |
| 7707 | |
| 7708 | var stack = []; |
| 7709 | var preserveWhitespace = options.preserveWhitespace !== false; |
| 7710 | var root; |
| 7711 | var currentParent; |
| 7712 | var inVPre = false; |
| 7713 | var inPre = false; |
| 7714 | var warned = false; |
| 7715 | |
| 7716 | function warnOnce (msg) { |
| 7717 | if (!warned) { |
| 7718 | warned = true; |
| 7719 | warn$2(msg); |
| 7720 | } |
| 7721 | } |
| 7722 | |
| 7723 | function endPre (element) { |
| 7724 | // check pre state |
| 7725 | if (element.pre) { |
| 7726 | inVPre = false; |
| 7727 | } |
| 7728 | if (platformIsPreTag(element.tag)) { |
| 7729 | inPre = false; |
| 7730 | } |
| 7731 | } |
| 7732 | |
| 7733 | parseHTML(template, { |
| 7734 | warn: warn$2, |
| 7735 | expectHTML: options.expectHTML, |
| 7736 | isUnaryTag: options.isUnaryTag, |
| 7737 | canBeLeftOpenTag: options.canBeLeftOpenTag, |
| 7738 | shouldDecodeNewlines: options.shouldDecodeNewlines, |
| 7739 | start: function start (tag, attrs, unary) { |
| 7740 | // check namespace. |
| 7741 | // inherit parent ns if there is one |
| 7742 | var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag); |
| 7743 | |
| 7744 | // handle IE svg bug |
| 7745 | /* istanbul ignore if */ |
| 7746 | if (isIE && ns === 'svg') { |
| 7747 | attrs = guardIESVGBug(attrs); |
| 7748 | } |
| 7749 | |
| 7750 | var element = { |
| 7751 | type: 1, |
| 7752 | tag: tag, |
no test coverage detected