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