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

@ -273,11 +273,21 @@ QDomElement VDomDocument::elementById(quint32 id, const QString &tagName, bool u
if (m_elementIdCache.contains(id)) if (m_elementIdCache.contains(id))
{ {
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)
{ {
return e; if (not tagName.isEmpty())
} {
if (e.tagName() == tagName)
{
return e;
}
}
else
{
return e;
}
}
} }
if (updateCache) if (updateCache)