MCPcopy Create free account
hub / github.com/TruthHun/BookStack / parseEndTag

Function parseEndTag

static/vuejs/vue.esm.js:7576–7627  ·  view source on GitHub ↗
(tagName, start, end)

Source from the content-addressed store, hash-verified

7574 }
7575
7576 function parseEndTag (tagName, start, end) {
7577 var pos, lowerCasedTagName;
7578 if (start == null) { start = index; }
7579 if (end == null) { end = index; }
7580
7581 if (tagName) {
7582 lowerCasedTagName = tagName.toLowerCase();
7583 }
7584
7585 // Find the closest opened tag of the same type
7586 if (tagName) {
7587 for (pos = stack.length - 1; pos >= 0; pos--) {
7588 if (stack[pos].lowerCasedTag === lowerCasedTagName) {
7589 break
7590 }
7591 }
7592 } else {
7593 // If no tag name is provided, clean shop
7594 pos = 0;
7595 }
7596
7597 if (pos >= 0) {
7598 // Close all the open elements, up the stack
7599 for (var i = stack.length - 1; i >= pos; i--) {
7600 if (process.env.NODE_ENV !== 'production' &&
7601 (i > pos || !tagName) &&
7602 options.warn) {
7603 options.warn(
7604 ("tag <" + (stack[i].tag) + "> has no matching end tag.")
7605 );
7606 }
7607 if (options.end) {
7608 options.end(stack[i].tag, start, end);
7609 }
7610 }
7611
7612 // Remove the open elements from the stack
7613 stack.length = pos;
7614 lastTag = pos && stack[pos - 1].tag;
7615 } else if (lowerCasedTagName === 'br') {
7616 if (options.start) {
7617 options.start(tagName, [], true, start, end);
7618 }
7619 } else if (lowerCasedTagName === 'p') {
7620 if (options.start) {
7621 options.start(tagName, [], false, start, end);
7622 }
7623 if (options.end) {
7624 options.end(tagName, start, end);
7625 }
7626 }
7627 }
7628}
7629
7630/* */

Callers 2

parseHTMLFunction · 0.70
handleStartTagFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected