Increasing specificity through pseudo-class repetition

Should repeated instances of a pseudo-class be ignored by the parser ? Or do they increase the selector's specificity ? (See testcase below).

The interoperable behavior today is the latter: Opera, Firefox and Safari all increase the selector's specificity. IE ignores the repeats and gives E:first-child the same specificity as E:first-child:first-child. Given that a) no such exceptions are noted in the spec and b) the author has explicitly repeated the pseudo-class, I expect this to be a bug for IE. I was wondering if this was originally intended, and whether/when it was used in practice.


Testcase:

<!doctype html>
<html>
<head>
<style>
        body { color:white; font-weight:bold; }

        div:first-child:first-child:first-child {
                background-color:green;
        }
        div:first-child:first-child {
                background-color:blue;
        }
        div:first-child {
                background-color:red;
        }

        span { color:black; }
        span:hover:hover { background-color:yellow; }
        span:hover { background-color:red; }
</style>
</head>
<body>
        <div>
                <p>If :first-child repeats increase specificity then this text has a green background</p>
        </div>
        <span>If :hover:hover has higher specificity then this will get a yellow background when hovered....</span>
</body>
</html>

Received on Tuesday, 14 July 2009 18:36:55 UTC