Compiler and co: defensive programming (computing the delta)

SVN:trunk[2047]
This commit is contained in:
Romain Quetiez
2012-05-29 11:48:24 +00:00
parent 00873c1cb9
commit 5dcbdbad95

View File

@@ -949,11 +949,14 @@ EOF
protected function ImportNodeAndPathDelta($oTargetDoc, $oNode)
{
// Preliminary: skip the parent if this node is organized hierarchically into the DOM
// The criteria to detect a hierarchy is: same tag + have an id
// Only class nodes are organized this way
$oParent = $oNode->parentNode;
while (($oParent instanceof DOMElement) && ($oParent->tagName == $oNode->tagName) && $oParent->hasAttribute('id'))
if ($oNode->tagName == 'class')
{
$oParent = $oParent->parentNode;
while (($oParent instanceof DOMElement) && ($oParent->tagName == $oNode->tagName) && $oParent->hasAttribute('id'))
{
$oParent = $oParent->parentNode;
}
}
// Recursively create the path for the parent
if ($oParent instanceof DOMElement)