Find the closest parent with a theme class on it. Note that we are not using $.fn.closest() on purpose here because this method gets called quite a bit and we need it to be as fast as possible.
187781
function( el, defaultTheme ) {
			var e = el[ 0 ],
				ltr = "",
				re = /ui-(bar|body|overlay)-([a-z])\b/,
				c, m;

			while ( e ) {
				c = e.className || "";
				if ( c && ( m = re.exec( c ) ) && ( ltr = m[ 2 ] ) ) {
					// We found a parent with a theme class
					// on it so bail from this loop.
					break;
				}

				e = e.parentNode;
			}

			// Return the theme letter we found, if none, return the
			// specified default.

			return ltr || defaultTheme || "a";
		}
174590
def findparent(self, inputtemplates):
        """"""
        for inputtemplate in inputtemplates:
            if self.unique == inputtemplate.unique:
                return inputtemplate.id
        return None
764204
function(target) {
		parentNode = target.parentNode;
		if (parentNode) {
			if (parentNode.classList.contains(CLASS_OFF_CANVAS_WRAP)) {
				return parentNode;
			} else {
				parentNode = parentNode.parentNode;
				if (parentNode.classList.contains(CLASS_OFF_CANVAS_WRAP)) {
					return parentNode;
				}
			}
		}
	}
1290227
function findParent(inst) {
  // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  // traversal, but caching is difficult to do correctly without using a
  // mutation observer to listen for all DOM changes.
  while (inst._hostParent) {
    inst = inst._hostParent;
  }
  var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
  var container = rootNode.parentNode;
  return ReactDOMComponentTree.getClosestInstanceFromNode(container);
}
57031
protected function nearestForClass($findClass, $type='default')
    {

        $cacheId = "$type|$findClass";

        if (isset($this->_class2Callable[$cacheId])) {
            return $this->_class2Callable[$cacheId];
        }

        if (!isset($this->_callables[$type])) {
            return;
        }

        if (isset($this->_callables[$type][$findClass])) {
            $this->_class2Callable[$type][$findClass] = $this->_callables[$type][$findClass];
            return $this->_callables[$type][$findClass];
        }

        $providers = &$this->_callables[$type];

        if (!$nearest = $this->findNearestForClass($providers, $findClass)) {
            return;
        }

        $this->_class2Callable[$type][$findClass] = $nearest;

        return $nearest;

    }
177443
private boolean parentIsNotOfClass(BaseCondition condition, Class<? extends BooleanCondition> expectedParentClass) {
      BaseCondition parent = condition.getParent();
      return parent != null && parent.getClass() != expectedParentClass;
   }
92910
function closestTo (element, selector, target) {
  let closestElement = closest(element, selector)
  return contains(target, closestElement) ? closestElement : null
}
481058
def best_parent( self, node, tree_type=None ):
        """"""
        parents = self.parents(node)
        selected_parent = None
        if node['type'] == 'type':
            module = ".".join( node['name'].split( '.' )[:-1] )
            if module:
                for mod in parents:
                    if mod['type'] == 'module' and mod['name'] == module:
                        selected_parent = mod 
        if parents and selected_parent is None:
            parents.sort( key = lambda x: self.value(node, x) )
            return parents[-1]
        return selected_parent
292982
public function closest($input) {
        $results = $this->_walkPathUntil('parentNode', $input, null, self::$MATCH_TYPE_LAST);

        return $this->result($results);
    }
734285
function closest (el, sel) {
  if (!el) return
  if (matches(el, sel)) {
    return el
  } else {
    return closest(el.parentNode, sel)
  }
}
616983
function ( el, selector, rootEl ) {
            var root = rootEl || document,
                parent = el.parentNode;
    
            if ( parent && parent != root ) {
                var match = this.match( parent, selector );
                return match? parent : this.closest( parent, selector );
            } else {
                return;
            }
        }
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
1135379
public TypeElement findParent(TypeElement typeElement, Set<TypeElement> parents) {
    TypeMirror type;
    while (true) {
      type = typeElement.getSuperclass();
      if (type.getKind() == TypeKind.NONE) {
        return null;
      }
      typeElement = (TypeElement) ((DeclaredType) type).asElement();
      if (containsTypeMirror(parents, type)) {
        return typeElement;
      }
    }
  }
891529
private function _closeStart()
    {
        if ($this->name === 'blank') {
            return;
        }

        if ($this->isSelfclosing()) {
            echo str_replace(':name', $this->realName, $this->brackets['close_short']);
            $this->_closed = true;
            $this->doCallback('closed');
            $this->destroy();
            if (!$this->hasOption('inline')) {
                Generator::lineBreak();
            }
            $this->_contentPrinted = true;
        } else {
            echo str_replace(':name', $this->realName, $this->brackets['close_start']);
            $this->doCallback('opened');
            if (!$this->inlineInner && !$this->hasOption('inline')) {
                Config::set('tabs', '++');
                Generator::lineBreak();
            }
        }
    }
542890
public function getParentClass()
    {
        $parentClass = $this->getBehaviorContent('parentClass');
        return null === $parentClass ? ($this->getTable()->getBaseQueryClass() != "" ? $this->getTable()->getBaseQueryClass() : 'ModelCriteria') : $parentClass;
    }
692590
def parent(self):
        ''''''

        if not hasattr(self, '_parent'):

            if 'parent' in self.kwargs:

                try:
                    self._parent = Page.objects.get(id=self.kwargs["parent"])
                except Exception as e:
                    raise e
            else:
                if hasattr(self.request, 'leonardo_page'):
                    self._parent = self.request.leonardo_page
                else:
                    return None

        return self._parent
848673
function( elem ) {

		// No argument, return index in parent
		if ( !elem ) {
			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
		}

		// index in selector
		if ( typeof elem === "string" ) {
			return indexOf.call( jQuery( elem ), this[ 0 ] );
		}

		// Locate the position of the desired element
		return indexOf.call( this,

			// If it receives a jQuery object, the first element is used
			elem.jquery ? elem[ 0 ] : elem
		);
	}