[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/khtml/css
From: Maks Orlovich <maksim () kde ! org>
Date: 2010-04-27 23:56:43
Message-ID: 20100428000008.071F3AC8A5 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1119920 by orlovich:
Reject invalid pseudos here.
This brings our test results on Selectors API test suite to:
CSS2.1: 98.4%: 992 passed, 16 failed
CSS3: 98.9%: 2163 passed, 25 failed
16 failures on both are due to the tests expecting foo(undefined) to behave
differently from foo(), which is a pretty odd thing to do in ECMAScript.
The 9 CSS3-only ones have to do with nested :not, probably needs a special reject.
(Will need to bug someone for advice on that)
We do lack NAMESPACE_ERR production, though. (Which surprisingly isn't covered, and is also annoying to
implement)
But man, this is way easier than XPath (less than a day of work!) and likely a lot faster.
Good thing I decided to put it into the feature plan, I guess.
M +18 -0 cssparser.cpp
--- trunk/KDE/kdelibs/khtml/css/cssparser.cpp #1119919:1119920
@@ -322,6 +322,24 @@
selectors.clear();
setupParser("@-khtml-selectors{", string, "} ");
runParser();
+
+ // Make sure to detect problems with pseudos, too
+ bool ok = true;
+ for (int i = 0; i < selectors.size(); ++i) {
+ DOM::CSSSelector* sel = selectors[i];
+ if(sel->match == CSSSelector::PseudoClass || sel->match == CSSSelector::PseudoElement) {
+ if (sel->pseudoType() == CSSSelector::PseudoOther) {
+ ok = false;
+ break;
+ }
+ }
+ }
+
+ if (!ok) {
+ qDeleteAll(selectors);
+ selectors.clear();
+ }
+
return selectors;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic