W3C home > Mailing lists > Public > www-style@w3.org > March 2012

Re: Allowing unknown pseudo classes and unknown pseudo element in the selector.

From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
Date: Sat, 10 Mar 2012 04:25:33 +0400
To: Erik Arvidsson <arv@chromium.org>
Cc: "www-style@w3.org" <www-style@w3.org>,Tony Chang <tony@chromium.org>,Boris Zbarsky <bzbarsky@mit.edu>,Tab Atkins Jr. <jackalmage@gmail.com>
Message-Id: <261151331339133@web92.yandex.ru>
Indeed it would be very nice.

For example, IE7 does not ignore entire rule if one of its selectors is unknown. This gives us ability to use same rule for IE7 and more modern browsers:

    .example:before,
    .example > SPAN {/**/}

Here :before is used for modern browsers, and SPAN is generated via JS for IE7 only.

Unlike IE7, IE8 has introduced new (ingenious!) parsing rule that now drops entire CSS rule if one of selectors is unknown. As a result, this simple case does not work in IE8:

    .example:last-child,
    .example.last {}

Here we [could] have :last-child for modern browsers, and "last" class could be generated via JS for IE8 only.

Instead, we are forced to duplicate all properties in a separate rule:

    .example:last-child {/* Properties for modern browsers. */ }
    .example.last {/* Exactly same properties duped for IE8. */}

That's at least unusable, and at most, well, completely pointless (mildly speaking).

Thanks.


08.03.2012, 22:52, "Erik Arvidsson" <arv@chromium.org>:
> Today we have a "bug" in WebKit [1] where we ignore unknown pseudo elements.
>
> #test { background: green }
> #test, ::foobar { background: red }
>
> in WebKit #test is red, in other browsers it is green.
>
> This intended behavior is actually making things worse. If the page
> author includes a new pseudo element/class from CSS4 and then a user
> visits the page in a browser that does not support the CSS4 pseudo the
> whole rule gets dropped. This is a real problem today when browsers
> introduce new experimental pseudo elements and classes. For example
> the following fails in all but WebKit
>
> #test { background: red }
> #test, ::-webkit-scrollbar { background: green }
>
> Today we don't drop the whole rule for unknown tag names, attribute
> names etc. We should not drop rules for unknown pseudos either.
>
> [1] https://bugs.webkit.org/show_bug.cgi?id=77838
>
> erik
Received on Saturday, 10 March 2012 00:26:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:48:51 GMT