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