OWeb/defaults/extensions/bbcode/JBBCode/ElementNode.php
public function closestParentOfType( $str ) {
        $str = strtolower($str);
        $currentEl = $this;
        
        while( strtolower($currentEl->getTagName()) != $str && $currentEl->hasParent() )
            $currentEl = $currentEl->getParent();
        
        if( strtolower($currentEl->getTagName()) != $str )
            return null;
        else
            return $currentEl;
    }
public function closestParentOfType( $str ) {
        $str = strtolower($str);
        $currentEl = $this;
        
        while( strtolower($currentEl->getTagName()) != $str && $currentEl->hasParent() )
            $currentEl = $currentEl->getParent();
        
        if( strtolower($currentEl->getTagName()) != $str )
            return null;
        else
            return $currentEl;
    }
public function closestParentOfType ( $ str ) { $ str = strtolower ( $ str ) ; $ currentEl = $ this ; while ( strtolower ( $ currentEl -> getTagName ( ) ) != $ str && $ currentEl -> hasParent ( ) ) $ currentEl = $ currentEl -> getParent ( ) ; if ( strtolower ( $ currentEl -> getTagName ( ) ) != $ str ) return null ; else return $ currentEl ; }
Traverses the parse tree upwards, going from parent to parent, until it finds a parent who has the given tag name. Returns the
parent with the matching tag name if it exists, otherwise returns null.

@param str the tag name to search for

@return the closest parent with the given tag name
Traverses the parse tree upwards going from parent to parent until it finds a parent who has the given tag name . Returns the parent with the matching tag name if it exists otherwise returns null .