Returns the close tag node if it exists.
328497
@Nullable
  public HtmlCloseTagNode getCloseTagNode() {
    if (numChildren() > 1) {
      return (HtmlCloseTagNode)
          getNodeAsHtmlTagNode(getChild(numChildren() - 1), /*openTag=*/ false);
    }
    return null;
  }
1005612
static CloseElementTag asEngineCloseElementTag(final ICloseElementTag closeElementTag) {

        if (closeElementTag instanceof CloseElementTag) {
            return (CloseElementTag) closeElementTag;
        }

        return new CloseElementTag(
                closeElementTag.getTemplateMode(), closeElementTag.getElementDefinition(), closeElementTag.getElementCompleteName(),
                null, closeElementTag.isSynthetic(), closeElementTag.isUnmatched(),
                closeElementTag.getTemplateName(), closeElementTag.getLine(), closeElementTag.getCol());

    }
26378
public function getClosingTag(): ?string
    {
        if (!in_array($this->nodeName, self::SELF_CLOSING_TAGS)) {
            return sprintf('</%s>', $this->nodeName);
        }

        return null;
    }
435457
function findClosestLink( ele )    {
        while ( ele ) {
            // Look for the closest element with a nodeName of "a".
            // Note that we are checking if we have a valid nodeName
            // before attempting to access it. This is because the
            // node we get called with could have originated from within
            // an embedded SVG document where some symbol instance elements
            // don't have nodeName defined on them, or strings are of type
            // SVGAnimatedString.
            if ( ( typeof ele.nodeName === "string" ) && ele.nodeName.toLowerCase() === "a" ) {
                break;
            }
            ele = ele.parentNode;
        }
        return ele;
    }
1121786
protected void closeStartTag() throws IOException {
		if (finished) {
			throw new IllegalArgumentException("trying to write past already finished output" + getLocation());
		}
		if (seenBracket) {
			seenBracket = seenBracketBracket = false;
		}
		if (startTagIncomplete || setPrefixCalled) {
			if (setPrefixCalled) {
				throw new IllegalArgumentException("startTag() must be called immediately after setPrefix()" + getLocation());
			}
			if (!startTagIncomplete) {
				throw new IllegalArgumentException("trying to close start tag that is not opened" + getLocation());
			}

			// write all namespace delcarations!
			writeNamespaceDeclarations();
			out.write('>');
			elNamespaceCount[depth] = namespaceEnd;
			startTagIncomplete = false;
		}
	}
1217278
protected function autoclose($tag) {
        $working = $this->current;
        do {
            if ($working->nodeType != XML_ELEMENT_NODE) {
                return false;
            }
            if ($working->tagName == $tag) {
                $this->current = $working->parentNode;

                return true;
            }
        } while ($working = $working->parentNode);
        return false;
    }
4483
public function tag($tag, $attr = null, $content = null, $close = false)
    {
        $tag = strtolower($tag);

        if (! empty($attr) && is_array($attr)) {
            $attr = $this->Attr->attr($attr);
        }

        if ($close) {
            return sprintf('<%s%s>%s</%1$s>', $tag, $attr, $content);
        } else {
            return sprintf('<%s%s>', $tag, $attr);
        }
    }
1074345
def close_node(self, node_id, *args, **kwargs):
        

        node = self.get_node(node_id)
        if node_id in self._used_mac_ids:
            i = self._used_mac_ids[node_id]
            self._free_mac_ids[node.project.id].insert(0, i)
            del self._used_mac_ids[node_id]
        yield from super().close_node(node_id, *args, **kwargs)
        return node
1093593
def closest(self):
        """"""

        current = self.tag
        closest = None
        while closest is None and current is not None:
            if self.match(current):
                closest = current
            else:
                current = self.get_parent(current)
        return closest
1135183
function Node(cfg) {

  this.namespace     = cfg.namespace || null;
  this.text          = cfg.text;
  this._selfCloseTag = cfg.selfCloseTag;


  Object.defineProperties(this, {
    nodeType: {
      value: cfg.nodeType
    },
    nodeName: {
      value: cfg.nodeType == 1 ? cfg.nodeName : '#text'
    },
    childNodes: {
      value: cfg.childNodes
    },
    firstChild: {
      get: function(){
        return this.childNodes[0] || null;
      }
    },
    lastChild: {
      get: function(){
        return this.childNodes[this.childNodes.length-1] || null;
      }
    },
    parentNode: {
      value: cfg.parentNode || null
    },
    attributes: {
      value: cfg.attributes || []
    },
    innerHTML: {
      get: function(){
        var
          result = '',
          cNode;
        for (var i = 0, l = this.childNodes.length; i < l; i++) {
          cNode = this.childNodes[i];
          result += cNode.nodeType === 3 ? cNode.text : cNode.outerHTML;
        }
        return result;
      }
    },
    outerHTML: {
      get: function(){
        if (this.nodeType != 3){
          var
            str,
            attrs = (this.attributes.map(function(elem){
              return elem.name + (elem.value ? '=' + '"'+ elem.value +'"' : '');
            }) || []).join(' '),
            childs = '';

          str = '<' + this.nodeName + (attrs ? ' ' + attrs : '') + (this._selfCloseTag ? '/' : '') + '>';

          if (!this._selfCloseTag){
            childs = (this._selfCloseTag ? '' : this.childNodes.map(function(child){
              return child.outerHTML;
            }) || []).join('');

            str += childs;
            str += '</' + this.nodeName + '>';
          }
        }
        else{
          str = this.textContent;
        }
        return str;
      }
    },
    textContent: {
      get: function(){
        if (this.nodeType == Node.TEXT_NODE){
          return this.text;
        }
        else{
          return this.childNodes.map(function(node){
            return node.textContent;
          }).join('').replace(/\x20+/g, ' ');
        }
      }
    }
  });
}
688162
def is_break_tag(self, el):
        """"""

        name = sv.util.lower(el.name) if self.type != 'xhtml' else el.name
        return name in self.break_tags or name in self.user_break_tags
269649
def get_previous_tag(cls, el):
        """"""

        sibling = el.previous_sibling
        while not cls.is_tag(sibling) and sibling is not None:
            sibling = sibling.previous_sibling
        return sibling
1274322
def closest(self, tag):
        """"""

        return CSSMatch(self.selectors, tag, self.namespaces, self.flags).closest()
701693
@Override
  protected void visitHtmlCloseTagNode(HtmlCloseTagNode node) {
    // This case occurs in the case where we encounter the end of a keyed element. If the open tag
    // mapped to this close tag contains a key node, pop the keyCounterStack to return
    // to the state before entering the keyed node.
    if (node.getTaggedPairs().size() == 1) {
      HtmlOpenTagNode openTag = (HtmlOpenTagNode) node.getTaggedPairs().get(0);
      if (openTag.getKeyNode() != null) {
        keyCounterStack.pop();
        getJsCodeBuilder().append(INCREMENTAL_DOM_POP_MANUAL_KEY.call());
      }
    }

    if (!node.getTagName().isDefinitelyVoid()) {
      emitClose(getTagNameCodeChunk(node.getTagName()));
    }
  }
7415
void closeNodeScope(Node n, int num) {
    mk = ((Integer)marks.pop()).intValue();
    while (num-- > 0) {
      Node c = popNode();
      c.jjtSetParent(n);
      n.jjtAddChild(c, num);
    }
    n.jjtClose();
    pushNode(n);
    node_created = true;
  }
562707
public TagKind getTagKind() {
    if (htmlTagNode instanceof HtmlOpenTagNode) {
      HtmlOpenTagNode openTagNode = (HtmlOpenTagNode) htmlTagNode;
      if (openTagNode.isSelfClosing() || openTagNode.getTagName().isDefinitelyVoid()) {
        return TagKind.VOID_TAG;
      }
      return TagKind.OPEN_TAG;
    } else {
      return TagKind.CLOSE_TAG;
    }
  }
391319
private Node getNode(boolean bDataRoot)
    {
        if (m_data == null)
        {
            DocumentBuilder db = Util.getDocumentBuilder();
            synchronized (db)
            {
                m_data = (Node)db.newDocument();
                String rootTag = ROOT_TAG;
                if (this.getMessageDataDesc(null) != null)
                	if (this.getMessageDataDesc(null).getKey() != null)
                		rootTag = this.getMessageDataDesc(null).getKey();
                ((Document)m_data).appendChild(((Document)m_data).createElement(rootTag));
            }
        }
        if (bDataRoot)
        	if (m_data instanceof Document)
        		return ((Document)m_data).getDocumentElement();
        return (Node)m_data;
    }