Iterate through a JSX tag's content until the closing tag is found, making sure to skip nested JSX and to not match closing tags in code blocks.
777856
function parseJSXContent(state, start, type) {
  var text,
      result,
      max = state.posMax,
      prevPos,
      oldPos = state.pos;

  state.pos = start;

  while (state.pos < max) {
    text = state.src.slice(state.pos)
    result = JSX_INLINE_CLOSE_TAG_PARSER.parse(text)

    prevPos = state.pos;
    state.md.inline.skipToken(state);

    if (result.status && result.value.value === type && prevPos === state.pos - 1) {
      // restore old state
      state.pos = oldPos;
      return { contentEnd: prevPos, closeEnd: prevPos + result.value.end.offset }
    }
  }

  // restore old state
  state.pos = oldPos;
}
664265
function endTagInText(p, token) {
    if (token.tagName === $.SCRIPT) {
        p.pendingScript = p.openElements.current;
    }

    p.openElements.pop();
    p.insertionMode = p.originalInsertionMode;
}
762793
function(options) {
        var nextSibling     = wysihtml5.dom.domNode(node).next({ignoreBlankTexts: true}),
            previousSibling = wysihtml5.dom.domNode(node).prev({ignoreBlankTexts: true});

        if (nextSibling && _isLineBreak(nextSibling)) {
          nextSibling.parentNode.removeChild(nextSibling);
        }
        if (previousSibling && _isLineBreak(previousSibling)) {
          previousSibling.parentNode.removeChild(previousSibling);
        }
      }
719063
function processImpliedEndTag(node) {
            var needFix = 0, endParentTagName;    // <ul><li>1<ul><li>2</ul></ul>
            // <ul><li>1<ul><li>2</ul></ul>
            if (endParentTagName = impliedEndTag[node.tagName]) {
                var from = stack.length - 1, parent = stack[from];    // <ol><li><ol><li>
                                                                      // parent ol break li check
                // <ol><li><ol><li>
                // parent ol break li check
                while (parent && !(parent.tagName in endParentTagName)) {
                    // <ul><li>1<div><li>2</div></ul>
                    if (parent.tagName === node.tagName) {
                        needFix = 1;
                        break;
                    }
                    from--;
                    parent = stack[from];
                }
                if (needFix) {
                    closeStackOpenTag(stack.length - 1, from - 1);
                }
            }
            return needFix;
        }
279228
function (tagName, tagAttributes) {
    if (this._done) {
      return;
    }

    this._openElementStack.push(tagName);

    try {
      this._errorIfUnexpectedTag(tagName);

      for (var attributeName in tagAttributes) {
        var attributeValue = tagAttributes[attributeName];

        this._errorIfUnexpectedAttribute(tagName, attributeName);
        this._errorIfUnexpectedAttributeValue(tagName, attributeName, attributeValue);
      }
    } catch (err) {
      this._finish(err);
    }
  }
1183431
def handle_startendtag(self, tag, attrs):
        """"""
        if tag.lower() in self.allowed_tag_whitelist:
            self.result += '<' + tag
            for (attr, value) in attrs:
                if attr.lower() in self.allowed_attribute_whitelist:
                    self.result += ' %s="%s"' % \
                        (attr, self.handle_attribute_value(value))
            self.result += ' />'
        else:
            if self.render_unallowed_tags:
                self.result += '&lt;' + cgi.escape(tag)
                for (attr, value) in attrs:
                    self.result += ' %s="%s"' % \
                        (attr, cgi.escape(value, True))
                self.result += ' /&gt;'
1095635
@Override
  void visitEnclosingElement(Tokenizer.Token value) throws IOException {
    printIndents();
    write("<" + value.getEditsElement().toString() + ">\n");
    tagQ.push(value.getEditsElement());
    depthCounter.incLevel();
  }
456894
private void popStackToClose(Token.EndTag endTag) {
        String elName = settings.normalizeTag(endTag.tagName);
        Element firstFound = null;

        for (int pos = stack.size() -1; pos >= 0; pos--) {
            Element next = stack.get(pos);
            if (next.nodeName().equals(elName)) {
                firstFound = next;
                break;
            }
        }
        if (firstFound == null)
            return; // not found, skip

        for (int pos = stack.size() -1; pos >= 0; pos--) {
            Element next = stack.get(pos);
            stack.remove(pos);
            if (next == firstFound)
                break;
        }
    }
386171
function processSnippet(item, profile) {
		item.start = item.end = '';
		if (!isVeryFirstChild(item) && profile.tag_nl !== false && shouldAddLineBreak(item, profile)) {
			// check if we’re not inside inline element
			if (isRoot(item.parent) || !abbrUtils.isInline(item.parent)) {
				item.start = '\n' + item.start;
			}
		}
		
		return item;
	}
1170010
function guardTextInMixins() {
      for (const { mixin, code, tag } of deferred) {
        if (calledInSensitiveContext.has(mixin)) {
          const guards = calledInSensitiveContext.get(mixin);
          if (code) {
            for (const guard of guards) {
              code.val = addGuard(guard, code.val);
              code.mustEscape = false;
            }
          } else if (guards.has(trustedScriptGuard)) {
            distrust(
              `HTML tag <${ tag.name
              }> may appear inside <script> which cannot have tag content via call to +${ mixin }`,
              tag);
          }
        } else if (code) {
          code.val = addGuard(trustedHTMLGuard, code.val);
          code.mustEscape = false;
        }
      }
    }
754695
function detectElement(tags){
			
				var resultdetect=false, $node = getSelectedNode(), parentsTag;
				
				if($node)
				{
					$.each(tags, function(i, val){
						parentsTag = $node.prop('tagName').toLowerCase();

						if (parentsTag == val)
							resultdetect = true;
						else
						{
							$node.parents().each(function(){
								parentsTag = $(this).prop('tagName').toLowerCase();
								if (parentsTag == val)
									resultdetect = true;
							});
						}
					});
					
					return resultdetect;
				}
				else 
					return false;
			}
1118414
private void checkCloseTagChildren(HtmlCloseTagNode closeTag) {
    HtmlAttributeNode phNameAttribute =
        closeTag.getDirectAttributeNamed(MessagePlaceholders.PHNAME_ATTR);
    HtmlAttributeNode phExAttribute =
        closeTag.getDirectAttributeNamed(MessagePlaceholders.PHEX_ATTR);
    // the child at index 0 is the tag name
    for (int i = 1; i < closeTag.numChildren(); i++) {
      StandaloneNode child = closeTag.getChild(i);
      if (child == phNameAttribute || child == phExAttribute) {
        continue; // the phname and phex attributes are validated later and allowed in close nodes
      }
      errorReporter.report(child.getSourceLocation(), UNEXPECTED_CLOSE_TAG_CONTENT);
    }
  }
1253036
function replaceElementTagMentions (element, selector) {
  const processor = selectorParser((selectors) => {
    let nodesToReplace = []

    /**
     * looping breaks if we replace dynamically
     * so instead collect an array of nodes to swap and do it at the end
     */
    selectors.walk((node) => {
      if (node.value === element.tag && node.type === 'tag') { nodesToReplace.push(node) }
    })

    nodesToReplace.forEach((node) => node.replaceWith(element.pseudos.root))
  })

  return processor.process(selector).result
}
438235
@Override
    public void skipElement() throws XMLStreamException
    {
        if (mCurrToken != START_ELEMENT) {
            throw new IllegalStateException(ErrorConsts.ERR_STATE_NOT_STELEM);
        }
        int nesting = 1; // need one more end elements than start elements

        while (true) {
            int type = next();
            if (type == START_ELEMENT) {
                ++nesting;
            } else if (type == END_ELEMENT) {
                if (--nesting == 0) {
                    break;
                }
            }
        }
    }
1040095
function(el, tagName, tagData){
		var helperTagCallback = tagData.options.get('tags.' + tagName,{proxyMethods: false}),
			tagCallback = helperTagCallback || tags[tagName];

		// If this was an element like <foo-bar> that doesn't have a component, just render its content
		var scope = tagData.scope,
			res;
			
		if(tagCallback) {
			res = can.__notObserve(tagCallback)(el, tagData);
		} else {
			res = scope;
		}

		//!steal-remove-start
		if (!tagCallback) {
			can.dev.warn('can/view/scanner.js: No custom element found for ' + tagName);
		}
		//!steal-remove-end

		// If the tagCallback gave us something to render with, and there is content within that element
		// render it!
		if (res && tagData.subtemplate) {

			if (scope !== res) {
				scope = scope.add(res);
			}
			var result = tagData.subtemplate(scope, tagData.options);
			var frag = typeof result === "string" ? can.view.frag(result) : result;
			can.appendChild(el, frag);
		}
	}
480349
function shouldRecycleElement(oldElement, props, tag) {
  return (
    !isTextNode(oldElement) &&
    oldElement.id === "" &&
    !nodeTypeDiffers(oldElement, tag)
  );
}
1112510
def _render_after(self, element):
        ''''''
        if element.inline_content:
            return "</%s>%s" % (element.tag, self.render_newlines())
        elif element.self_close:
            return self.render_newlines()
        elif self.children:
            return "%s</%s>\n" % (self.spaces, element.tag)
        else:
            return "</%s>\n" % (element.tag)