MCPcopy Create free account
hub / github.com/MMmaXingXing/mini-vue / parseElement

Function parseElement

code/src/compiler-core/src/parse.ts:84–100  ·  view source on GitHub ↗
(context, ancestors)

Source from the content-addressed store, hash-verified

82};
83
84const parseElement = (context, ancestors) => {
85 // Implement
86 // 1. 解析tag
87 const element: any = parseTag(context, TagType.START);
88 ancestors.push(element);
89 // 如果有子节点则内部递归处理
90 element.children = parseChildren(context, ancestors);
91 ancestors.pop();
92 // if (context.source) {
93 if (startsWithEndTagOpen(context.source, element.tag)) {
94 parseTag(context, TagType.END);
95 } else {
96 throw new Error(`缺少结束标签:${element.tag}`);
97 }
98 // }
99 return element;
100};
101
102const startsWithEndTagOpen = (source, tag) => {
103 return (

Callers 1

parseChildrenFunction · 0.70

Calls 4

parseTagFunction · 0.70
parseChildrenFunction · 0.70
startsWithEndTagOpenFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected