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

Function parseEndTag

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

Source from the content-addressed store, hash-verified

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

Callers 2

parseHTMLFunction · 0.70
handleStartTagFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected