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

Function parseEndTag

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

Source from the content-addressed store, hash-verified

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

Callers 2

parseHTMLFunction · 0.70
handleStartTagFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected