function find_ancestor_tag($tag)
{
global $debugObject;
if (is_object($debugObject)) {
$debugObject->debugLogEntry(1);
}
// Start by including ourselves in the comparison.
$returnDom = $this;
while (!is_null($returnDom)) {
if (is_object($debugObject)) {
$debugObject->debugLog(2, "Current tag is: " . $returnDom->tag);
}
if ($returnDom->tag == $tag) {
break;
}
$returnDom = $returnDom->parent;
}
return $returnDom;
}