Returns the closest parent form tag, or null if there is none.
172462
protected Form getNearestForm()
    {
        Tag parentTag = getParent();
        while (parentTag != null) {
            if (parentTag instanceof Form)
                return (Form) parentTag;
            parentTag = parentTag.getParent();
        }
        return null;
    }
1123057
public String getFormattedParentValue()
   {
      String result = null;
      if (m_elements.size() > 2)
      {
         result = joinElements(m_elements.size() - 2);
      }
      return result;
   }
1312717
public static <T> T findAncestor(JspTag from, Class<? extends T> clazz) throws JspException {
		T parent = clazz.cast(SimpleTagSupport.findAncestorWithClass(from, clazz));
		if(parent==null) throw new LocalizedJspException(accessor, "JspTagUtils.findAncestor.notFound", getClassName(from.getClass()), getClassName(clazz));
		return parent;
	}
1197428
protected static Element getChildElement(final Element parent, final String tagName) {
        List<Element> elements = getElements(parent, tagName);
        if (elements.size() > 0) {
            return elements.get(0);
        } else {
            return null;
        }
    }
1083897
protected void closeStartTag() throws SAXException
    {

        m_elemContext.m_startTagOpen = false;

        final String localName = getLocalName(m_elemContext.m_elementName);
        final String uri = getNamespaceURI(m_elemContext.m_elementName, true);

        // Now is time to send the startElement event
        if (m_needToCallStartDocument)
        {
            startDocumentInternal();
        }
        m_saxHandler.startElement(uri, localName, m_elemContext.m_elementName, m_attributes);
        // we've sent the official SAX attributes on their way,
        // now we don't need them anymore.
        m_attributes.clear();

        if(m_state != null)
          m_state.setCurrentNode(null);
    }
424007
public function getForm()
    {
        $elementString = '';

        if (isset($this->attributes[self::$formHolder[self::$formName]])) {
            $elementString .= $this->attributes[self::$formHolder[self::$formName]][self::$formName];
        }

        $elementString .= $this->getHtmlElements();

        $close = null;
        $close = self::$formHolder[self::$formName].'_close';

        if (isset($this->attributes[$close])) {
            $elementString .= $this->attributes[$close];
        }

        return $this->element[self::$formHolder[self::$formName]] = $elementString;
    }
870637
@Override
    public String getParent () {
        String str = this.url.getAuthority();

        if ( str != null && !str.isEmpty() ) {
            StringBuffer sb = new StringBuffer("smb://");

            sb.append(str);

            String urlpath = getURLPath();
            if ( urlpath.length() > 1 ) {
                sb.append(urlpath);
            }
            else {

                sb.append('/');
            }

            str = sb.toString();

            int i = str.length() - 2;
            while ( str.charAt(i) != '/' ) {
                i--;
            }

            return str.substring(0, i + 1);
        }

        return "smb://";
    }
600866
function closest (el, selector, scope) {
  scope = scope || document.documentElement

  // walk up the dom
  while (el && el !== scope) {
    if (matches(el, selector)) return el
    el = el.parentNode
  }

  // check scope for match
  return matches(el, selector) ? el : null
}
547941
function getOffsetParent(element) {
  if (!element) {
    return document.documentElement;
  }

  const noOffsetParent = isIE(10) ? document.body : null;

  // NOTE: 1 DOM access here
  let offsetParent = element.offsetParent || null;
  // Skip hidden elements which don't have an offsetParent
  while (offsetParent === noOffsetParent && element.nextElementSibling) {
    offsetParent = (element = element.nextElementSibling).offsetParent;
  }

  const nodeName = offsetParent && offsetParent.nodeName;

  if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
    return element ? element.ownerDocument.documentElement : document.documentElement;
  }

  // .offsetParent will return the closest TH, TD or TABLE in case
  // no offsetParent is present, I hate this job...
  if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
    return getOffsetParent(offsetParent);
  }

  return offsetParent;
}
700022
def get_next_tag(cls, el):
        """"""

        sibling = el.next_sibling
        while not cls.is_tag(sibling) and sibling is not None:
            sibling = sibling.next_sibling
        return sibling
241076
private IScriptReporter getParentScriptReporter()
    {
        Tag parent = getParent();
        if (parent == null)
            return null;
        return (IScriptReporter) SimpleTagSupport.findAncestorWithClass(parent, IScriptReporter.class);
    }
685341
public static TagModel getSingleParent(TagModel tag)
    {
        final Iterator<TagModel> parents = tag.getDesignatedByTags().iterator();
        if (!parents.hasNext())
            throw new WindupException("Tag is not designated by any tags: " + tag);

        final TagModel maybeOnlyParent = parents.next();

        if (parents.hasNext()) {
            StringBuilder sb = new StringBuilder();
            tag.getDesignatedByTags().iterator().forEachRemaining(x -> sb.append(x).append(", "));
            throw new WindupException(String.format("Tag %s is designated by multiple tags: %s", tag, sb.toString()));
        }

        return maybeOnlyParent;
    }
483308
function _findNearestDOMParent(element, parentNodeName) {
			while (element.nodeName !== parentNodeName) {
				if (element.nodeName === "CONTROL-TREE") {
					break;
				}
				element = element.parentNode;
			}

			return element;
		}
741042
static public Element selectParentElement(Element element, String parentName) {
		Element parentElement = (Element) element.getParentNode();
		if (parentElement == null) {
			return null;
		}
		if (parentElement.getTagName().equals(parentName)) {
			return parentElement;
		}
		return selectParentElement(parentElement, parentName);
	}
713656
public function find_parent_by_tag($tag)
	{
		$node = $this->parent();

		while($this->parent() != null
			&& !$node instanceof Node_Container_Document)
		{
			if($node->tag() === $tag)
				return $node;

			$node = $node->parent();
		}

		return null;
	}
586391
private static Element getFirstChildElement(Node parent) {
		NodeList nodeList = parent.getChildNodes();
		for (int i = 0; i < nodeList.getLength(); i++) {
			Node node = nodeList.item(i);
			if (node instanceof Element) {
				return (Element) node;
			}
		}
		return null;
	}
227643
def parent_tags(self):
        """"""
        tags = set()

        for addr in self._addresses:
            if addr.attr == 'text':
                tags.add(addr.element.tag)
            tags.update(el.tag for el in addr.element.iterancestors())

        tags.discard(HTMLFragment._root_tag)
        return frozenset(tags)