diff --git a/code/nel/include/nel/gui/css_selector.h b/code/nel/include/nel/gui/css_selector.h index 84b039089..b2b5372e9 100644 --- a/code/nel/include/nel/gui/css_selector.h +++ b/code/nel/include/nel/gui/css_selector.h @@ -84,6 +84,9 @@ namespace NLGUI // NOTE: Does not check combinator bool match(const CHtmlElement &elm) const; + // debug + std::string toString() const; + private: bool matchClass(const CHtmlElement &elm) const; bool matchAttributes(const CHtmlElement &elm) const; @@ -91,7 +94,7 @@ namespace NLGUI // match An+B rule to child index (1 based) bool matchNth(sint childNr, sint a, sint b) const; - + // parse nth-child string to 'a' and 'b' components // :nth-child(odd) // :nth-child(even) diff --git a/code/nel/src/gui/css_parser.cpp b/code/nel/src/gui/css_parser.cpp index 0a4288d12..d34dc8f7a 100644 --- a/code/nel/src/gui/css_parser.cpp +++ b/code/nel/src/gui/css_parser.cpp @@ -631,18 +631,9 @@ namespace NLGUI { result.clear(); } - else if (result.empty() || !current.empty()) + else if (!current.empty()) { - // pseudo element like ':before' can only be set on the last selector - if (!result.empty() && !pseudoElement.empty()) - { - // failed - result.clear(); - } - else - { - result.push_back(current); - } + result.push_back(current); } return result; diff --git a/code/nel/src/gui/css_selector.cpp b/code/nel/src/gui/css_selector.cpp index 0384f561a..46806a2db 100644 --- a/code/nel/src/gui/css_selector.cpp +++ b/code/nel/src/gui/css_selector.cpp @@ -310,5 +310,43 @@ namespace NLGUI } } + std::string CCssSelector::toString() const + { + std::string ret; + ret += Element; + ret += Id; + if (!Class.empty()) + { + for(uint i = 0; i