If you’ve been reading this blog, you’ll know that Opera has been making great progress on the CSS3 selectors front in the latest version of its engine – Presto Core-2. While Opera 9.5 does pass every test in the CSS3.info selectors test, it wasn’t without issues. The test doesn’t test the
::selectionpseudo element. It also doesn’t test what happens when manipulating the markup through the DOM. Both of these were not supported in Core-2, but that is now not the case.
If you go to this test page (Warning Geocities) with the latest Opera weekly, you’ll notice it is now working correctly. This is the last selector that Opera didn’t support. The dynamic behaviour of the selectors have also been fixed. If you head off to Quirksmode and try out either the :first-child and :last-child, :only-child, :first-line and :first-letter or the :empty tests, you’ll find that they all work. Although it is most likely not without bugs (what software is?), it seems Opera 9.5 will be the first browser that fully supports all selectors in CSS correctly. It could be that Konqueror has fixed the issues high-lighted on PPK’s blog, but I don’t have a copy to test. Leave a comment if that is the case. Konqueror does fantastically well even if it doesn’t support everything.
You can skip to the end and leave a response.
I just got Opera 9.5 build 4634 (Mac), and that test page didn’t seem to work right for me.
The test text wasn’t read, so I doubt :contains works right.
The disabled text in the forums wasn’t green, and :value wasn’t purple.
nth-of-type seems backwards. It was gray before black, not black before gray.
Someone else please confirm.
One of the tests is for :contains – is that still part of CSS3?
It seems to be missing from http://www.w3.org/TR/css3-selectors/, but I know it was in an earlier draft. It would be brilliant if it was in – the ability to do “conditional formatting”, as per MS Excel spreadsheets, would open up a whole new area on the web. (Plus things like “find on page”).
I’m on Konqueror 4.0.1 (using KDE 4.0.1) and this is what I observe from the test:
- Contains works. The test text is red.
- The enabled test works. The text is italics and red.
- The disabled test kind of works. The form field is indeed disabled (grayed out background) and the text is not italics. The text color, however, is not green.
- The value test fails, apparently. The text color is not purple.
- Selection test fails. The text does not turn red.
- nth-child test passes, just like in Konqueror 3.5.8.
- nth-of-type child fails, apparently. The first image is stroked with a gray border and the second image has a black border, contrary to the description of the test.
So it looks like KHTML has a little bit of work to do but based on its past record, I expect it to support these selectors and pseudo-classes very soon.
Is that temporarily or permanent? I see the CSS3 docs got a space for it, but it’s blank. http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#content-selectors
David, why the test you mentioned works in Opera? IMO the test is invalid. It uses “:selection” not “::selection”. (http://www.w3.org/TR/css3-selectors/#UIfragments) It shouldn’t work in Opera, as it doesn’t work in Webkit. The proper test case is available on a page: http://www.quirksmode.org/css/selection.html