MCPcopy Create free account
hub / github.com/Tencent/kbone / parseEndTag

Function parseEndTag

packages/miniprogram-render/src/tree/parser.js:168–190  ·  view source on GitHub ↗
(tag, tagName)

Source from the content-addressed store, hash-verified

166 }
167
168 function parseEndTag(tag, tagName) {
169 let pos
170
171 if (!tagName) {
172 pos = 0
173 } else {
174 // 找到同名的开始标签
175 tagName = tagName.toLowerCase()
176
177 for (pos = stack.length - 1; pos >= 0; pos--) {
178 if (stack[pos] === tagName) break
179 }
180 }
181
182 if (pos >= 0) {
183 // 关闭开始标签和结束标签中的所有标签
184 for (let i = stack.length - 1; i >= pos; i--) {
185 if (handler.end) handler.end(stack[i])
186 }
187
188 stack.length = pos
189 }
190 }
191}
192
193/**

Callers 1

tokenizeFunction · 0.70

Calls 1

endMethod · 0.80

Tested by

no test coverage detected