Fix error in VDomDocument::elementById.

Searching in cache did not check tag if provided.
This commit is contained in:
Roman Telezhynskyi 2020-03-18 14:29:28 +02:00
parent b756460da8
commit 4fa2b76f01

View File

@ -275,10 +275,20 @@ QDomElement VDomDocument::elementById(quint32 id, const QString &tagName, bool u
{ {
const QDomElement e = m_elementIdCache.value(id); const QDomElement e = m_elementIdCache.value(id);
if (e.parentNode().nodeType() != QDomNode::BaseNode) if (e.parentNode().nodeType() != QDomNode::BaseNode)
{
if (not tagName.isEmpty())
{
if (e.tagName() == tagName)
{ {
return e; return e;
} }
} }
else
{
return e;
}
}
}
if (updateCache) if (updateCache)
{ // Cached missed { // Cached missed