Function to get html element lang value

feature/css-lang-var
Nimetu 4 years ago
parent 5f2c8d9538
commit 86f797cdbd

@ -84,6 +84,9 @@ namespace NLGUI
TStyle getPseudo(const std::string &key) const;
void setPseudo(const std::string &key, const TStyle &style);
// return lang property for css :lang() pseudo class
std::string getInheritedLanguage() const;
private:
// pseudo elements like ":before" and ":after"
std::map<std::string, TStyle> _Pseudo;

@ -122,6 +122,21 @@ namespace NLGUI
}
}
// ***************************************************************************
std::string CHtmlElement::getInheritedLanguage() const
{
const CHtmlElement *node = this;
while(node)
{
if (node->hasAttribute("lang"))
return node->getAttribute("lang");
node = node->parent;
}
return "";
}
// ***************************************************************************
std::string CHtmlElement::toString(bool tree, uint depth) const
{

Loading…
Cancel
Save