/*
Get a single element (first element) under a base element matching a tag
509082
protected Element getElement(Element base, String childTag) {
	    Element[] elements = getElements(base, childTag);
	    if (elements == null) {
	        return null;
	    } else {
	        return elements[0];
		}
	}
811318
private String getElementValue(Element parent, String elementName) {
        String value = null;
        NodeList nodes = parent.getElementsByTagName(elementName);
        if (nodes.getLength() > 0) {
            value = nodes.item(0).getChildNodes().item(0).getNodeValue();
        }
        return value;
    }
589270
function getClosestNode (element, method, selector) {
        do {
            element = element[method]
        } while (element && ((selector && !matches(element, selector)) || !util.isElement(element)))
        return element
    }
1067601
function getSelector(node) {
  var selector = arguments.length <= 1 || arguments[1] === undefined ? [node.name] : arguments[1];

  var parent = node.parent;
  if (parent) {
    var children = parent.children;
    var matches = children.filter(function (child) {
      return child.name === node.name;
    });
    if (matches.length > 1) {
      for (var i = 0, l = matches.length; i < l; i++) {
        if (matches[i] === node) {
          selector[0] = selector[0] + ':nth-of-type(' + (i + 1) + ')';
          break;
        }
      }
    }
    selector.unshift(parent.name);
  }
  return parent && parent.parent ? getSelector(parent, selector) : selector.join(' > ');
}
974304
function _get(refelm, selector)
    {

        function find(elm, selectorFragment)
        {
            var c, results = selectorFragment.id
			?
				((c = ((elm && elm.ownerDocument) || _document).getElementById(selectorFragment.id)) && _isDescendant(c, elm)) ? [c] : []
			:
				toArray(elm.getElementsByTagName(selectorFragment.tag ? selectorFragment.uTag : "*"));
            c = results.length;

            if (c > 0 && (selectorFragment.id || selectorFragment.classes))
            {
                while (c--)
                {
                    if (!_match(results[c], selectorFragment)) results.splice(c, 1)
                }
            }
            return results
        }


        function toArray(nodes)
        {
            try
            {
                return Array.prototype.slice.call(nodes)
            }
            catch (e)
            {
                var arr = [];
                for (var i = 0; i < nodes.length; i++) arr.push(nodes[i]);
                return arr
            }
        }


        function contains(o)
        {
            for (var c = results.length; c--; )
            {
                if (results[c] === o) return _true;
            }
            return _false
        }

        var results = [],
			elements = [refelm],
			selectorFragments = _sel(selector),
			c, lc,
			d, ld,
			e, le,
			fragment,
			elm, elms;

        if (selectorFragments.length == 0) selectorFragments = [{}];

        for (c = 0, lc = selectorFragments.length; c < lc; c++)
        {
            fragment = selectorFragments[c];
            for (d = 0, ld = elements.length; d < ld; d++)
            {
                elm = elements[d];
                switch (fragment.rel)
                {
                    case ">":
                        var children = elm.childNodes;
                        for (e = 0, le = children.length; e < le; e++)
                        {
                            if (_match(children[e], fragment))
                            {
                                results.push(children[e])
                            }
                        }
                        break;

                    case "~":
                        while (elm = elm.nextSibling)
                        {
 							
							if (_match(elm, fragment))
                            {
                                if (contains(elm))
                                {
                                    break;
                                }
                                results.push(elm);
                            }
                        }
                        break;

                    case "+":
                        while ((elm = elm.nextSibling) && elm.nodeType != 1) { };
                        if (elm && _match(elm, fragment))
                        {
                            results.push(elm)
                        }
						
                        break;

                    default:
                        elms = find(elm, fragment);
                        if (c > 0)
                        {
                            for (e = 0, le = elms.length; e < le; e++)
                            {
                                if (!contains(elms[e])) results.push(elms[e])
                            }
                        }
                        else { results = results.concat(elms) }
                        break;
                }
            }

            if (results.length === 0) return [];
            elements = results.splice(0, results.length)

        }
        return elements
    }
718732
private String getTagValue(String tag, String[] input, String defaultValue) {
		for (String arg : input) {
			Matcher matcher = CommandLineArgs.pattern.matcher(arg);
			// Get tagname and contents of tag
			if (matcher.find()) {
				String tagname = matcher.group(1);
				if (tag.equals(tagname)) {
					return matcher.group(2);
				}
			}
		}
		return defaultValue;
	}
1001217
def get_first_of_element(element, sub, contype=None):
    
    content = element.xpath(sub)
    return list_or_empty(content, contype)
1214259
function (element, tagName) {
            if (tagName.indexOf(",") === -1)
                return element.getElementsByTagName(tagName);
            return element.querySelectorAll(tagName);
        }
352240
protected Element findTag(String tagName, Element element) {
        Node result = element.getFirstChild();
        
        while (result != null) {
            if (result instanceof Element
                    && (tagName.equals(((Element) result).getNodeName()) || tagName
                            .equals(((Element) result).getLocalName()))) {
                break;
            }
            result = result.getNextSibling();
        }
        
        return (Element) result;
    }
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
1064570
def getElementById(id: str) -> Optional[Node]:
    """"""
    elm = Element._elements_with_id.get(id)
    return elm
1134937
public static Element getElement(Element parent, String tagName) {
        List<Element> children = getElements(parent, tagName);

        if (children.isEmpty()) {
            return null;
        } else {
            return children.get(0);
        }
    }
86352
function(el, s) { //el is the element and s the selector of the closest item to find
      // source http://gomakethings.com/climbing-up-and-down-the-dom-tree-with-vanilla-javascript/
      var f = s.charAt(0);
      for (; el && el !== document; el = el.parentNode) { // Get closest match
        if (f === '.') { // If selector is a class
          if (document.querySelector(s) !== undefined) {
            return el;
          }
        }
        if (f === '#') { // If selector is an ID
          if (el.id === s.substr(1)) {
            return el;
          }
        }
      }
      return false;
      }
910134
function get(dom) {
      return dom.tagName && __TAG_IMPL[getAttribute(dom, IS_DIRECTIVE) ||
        getAttribute(dom, IS_DIRECTIVE) || dom.tagName.toLowerCase()]
    }
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;
        }
    }
281922
function baseGetTag(value) {
  if (value == null) {
    return value === undefined ? undefinedTag : nullTag;
  }
  return (symToStringTag && symToStringTag in Object(value))
    ? _getRawTag(value)
    : _objectToString(value);
}
1182803
function baseGetTag(value) {
    if (value == null) {
      return value === undefined ? undefinedTag : nullTag;
    }
    return symToStringTag && symToStringTag in Object(value)
      ? getRawTag(value)
      : objectToString(value);
  }