Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intent to unprefix: ::-moz-selection.

172 views
Skip to first unread message

Emilio Cobos Álvarez

unread,
Mar 26, 2018, 9:17:02 AM3/26/18
to dev-pl...@lists.mozilla.org
Hi,

In bug 509958 I intend to unprefix the ::-moz-selection pseudo-element.

The situation here is not great wrt the spec saying what we do, or what
other implementations do for that matter, see [1].

However other engines have shipped this unprefixed for a long time with
the same semantics that we implement, and we're seeing webcompat
problems due to people forgetting to include ::-moz-selection in their
style sheets, see bug 1427680 or bug 1448670 for some examples.

Given I don't think other engines have any incentive to implement what
the spec says (given it's slower, and has the chance of giving them
webcompat headache), and that we're compatible with them, I proposed to
adapt the spec to reality in that spec issue, and unprefix our
pseudo-element.

Let me know if there's any concerns with this plan. Thanks!

-- Emilio

[1]: https://github.com/w3c/csswg-drafts/issues/2474

Boris Zbarsky

unread,
Mar 26, 2018, 10:14:06 AM3/26/18
to
On 3/26/18 3:16 AM, Emilio Cobos Álvarez wrote:
> However other engines have shipped this unprefixed for a long time with
> the same semantics that we implement

https://bugzilla.mozilla.org/show_bug.cgi?id=509958#c14 claims the
semantics are not actually quite the same. Have we done some testing
here? Including on Edge? It would be best to just have matching
semantics, instead of unprefixing with slightly different behavior.

-Boris

Emilio Cobos Álvarez

unread,
Mar 27, 2018, 4:38:56 PM3/27/18
to Boris Zbarsky, dev-pl...@lists.mozilla.org
On 3/26/18 4:13 PM, Boris Zbarsky wrote:
> On 3/26/18 3:16 AM, Emilio Cobos Álvarez wrote:
>> However other engines have shipped this unprefixed for a long time with
>> the same semantics that we implement
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=509958#c14 claims the
> semantics are not actually quite the same.  Have we done some testing
> here?  Including on Edge?

So, when I went through the bug I didn't know at all what that comment
was about (and the account that posted it was gone so couldn't ask), but
it seems we don't respect the ::selection background when selecting images.

That looks like an easy fix though, I'll ensure it gets fixed before
landing. Filed bug 1449010.

> It would be best to just have matching
> semantics, instead of unprefixing with slightly different behavior.

Haven't tested Edge (because I don't have it locally), but will make
sure that gets done before landing that patch.

-- Emilio

> -Boris
> _______________________________________________
> dev-platform mailing list
> dev-pl...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform

twisn...@mozilla.com

unread,
Mar 27, 2018, 6:09:34 PM3/27/18
to
On Tuesday, March 27, 2018 at 4:38:56 PM UTC-4, Emilio Cobos Álvarez wrote:
> That looks like an easy fix though, I'll ensure it gets fixed before
> landing. Filed bug 1449010.

If it helps, I had a patchset for this in bug 292563, but ran into an odd reftest failure that I never had time to figure out.

Emilio Cobos Álvarez

unread,
Mar 31, 2018, 9:49:06 AM3/31/18
to dev-pl...@lists.mozilla.org
Ah, I see, interesting!

I used negative reftests (!=) to test this, instead of just trying to
overlay the image, which looks a little bit more fragile.

Given my patch just landed, I'll dupe that bug. Thanks!

-- Emilio

Ehsan Akhgari

unread,
Apr 9, 2018, 11:42:43 AM4/9/18
to Emilio Cobos Álvarez, dev-pl...@lists.mozilla.org
::-moz-selection seems like a fairly popular feature. PublicWWW claims
it's seen on a million sites:
https://publicwww.com/websites/%22%3A%3A-moz-selection%22/

After this change, is it feasible to detect the usage of the prefixed
pseudo-element so that existing code that uses ::-moz-selection would emit
a helpful console warning? It would be nice to have a way to communicate
to web developers that they can now remove the Gecko specific rules.

On Mon, Mar 26, 2018 at 9:21 AM Emilio Cobos Álvarez <emi...@crisal.io>
wrote:

> Hi,
>
> In bug 509958 I intend to unprefix the ::-moz-selection pseudo-element.
>
> The situation here is not great wrt the spec saying what we do, or what
> other implementations do for that matter, see [1].
>
> However other engines have shipped this unprefixed for a long time with
> the same semantics that we implement, and we're seeing webcompat
> problems due to people forgetting to include ::-moz-selection in their
> style sheets, see bug 1427680 or bug 1448670 for some examples.
>
> Given I don't think other engines have any incentive to implement what
> the spec says (given it's slower, and has the chance of giving them
> webcompat headache), and that we're compatible with them, I proposed to
> adapt the spec to reality in that spec issue, and unprefix our
> pseudo-element.
>
> Let me know if there's any concerns with this plan. Thanks!
>
> -- Emilio
>
> [1]: https://github.com/w3c/csswg-drafts/issues/2474

Emilio Cobos Álvarez

unread,
May 10, 2018, 11:12:23 AM5/10/18
to dev-pl...@lists.mozilla.org
Sorry for not following up on this earlier, Ehsan, somehow this slipped
through my inbox.

On 4/6/18 1:26 AM, Ehsan Akhgari wrote:
> ::-moz-selection seems like a fairly popular feature. PublicWWW claims
> it's seen on a million sites:
> https://publicwww.com/websites/%22%3A%3A-moz-selection%22/
>
> After this change, is it feasible to detect the usage of the prefixed
> pseudo-element so that existing code that uses ::-moz-selection would emit
> a helpful console warning? It would be nice to have a way to communicate
> to web developers that they can now remove the Gecko specific rules.

It is feasible, but it's not clear to me how worth it is to land this
now. In particular, we're going to keep parsing ::-moz-selection for now
as an alias, since as you mentioned it's a fairly popular feature, and
people won't be able to remove it for a while if they want to support
ESR and similar.

If we decide to remove the prefixed version, developers would get a in
the console automatically if they have the CSS error filter enabled that
would look like:

Unknown pseudo-class or pseudo-element ‘-moz-selection’. Ruleset
ignored due to bad selector.

Which should be enough to hint them that they can remove it.

-- Emilio

Emilio Cobos Álvarez

unread,
May 10, 2018, 11:25:45 AM5/10/18
to dev-pl...@lists.mozilla.org
In the CSSWG April F2F in Berlin this was extensively discussed and the
CSSWG allowed / recommended us to unprefix this despite changing the spec.

Just landed the change unprefixing this on inbound, let me know if you
see something broken because of it.

Thanks!

-- Emilio
0 new messages