-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-variables] [selectors] Should custom properties work for :visited? #2263
Comments
Gecko's behavior seems to be the only one that makes any sense to me, reading the spec. |
In my opinion, Blink/WebKit's behavior seems to make more sense. Custom properties are not allowed visited properties, so In Edge 16, the link is also brown. |
CSS Selectors says "record the values of the allowed :visited properties", but it does not specify if the recorded value is the specified one or the computed one. It seems Firefox does the latter and the others do the former. |
I guess that's fair, yeah... It's somewhat weird that they do variable substitution but not computation. |
IMHO, it shouldn't matter in this case. The |
True, but The former will compute to |
I think from the spec wording, Firefox is right. "Compute the element's style as if the relevant link was :visited" should include matching, cascading, and resolving variable references. I'm not sure how could you justify that something like: <!doctype html>
<style>
:link {
--foo: brown;
}
:visited {
--foo: yellow;
color: var(--foo);
}
</style>
<a href="">Which color?</a> Should display brown if the link is visited, since clearly computing the style as if the element was :visited would've never matched |
@Loirooriol Oof, that's a stray commit. The exact spec text for Under the current spec, both interpretations are valid, although ignoring |
In my opinion the :visited and :link should be removed from specification because of privacy reason. |
I think that's not realistic. When writing Gecko's new style engine we almost broke visited in some subtle ways and people noticed: https://bugzilla.mozilla.org/show_bug.cgi?id=1417781 It'd be nice to do something like https://bugzilla.mozilla.org/show_bug.cgi?id=1398414, ensure it's web-compatible, ship it, and then :visited stops being a privacy issue at all and all this complexity goes away, but not sure that's going to be done any time soon. |
Any privacy setting to disable/enable it? BTW. I think the spec should be created with security in mind. Same-origin policy? To mark as visited only internal links? Then all styles can work. Visiting of the same origin sub-pages can be detected with other methods. For example onclick or cookies/IP. |
The commit (that I accidentally pushed earlier; it's still visible from the #2105 PR) specifies in step 2 that you compute styles, then in step 3 you record the styles; the implication is that you're recording computed styles. I can make that more clear. (The custom property itself is not recorded, and so any properties other than the ":visited properties" won't see the values of custom properties set in a :visited rule. But the :visited properties will, since their var()s get resolved before they're recorded.) |
Thus, in @emilio's example, the link is yellow when visited, but a |
…shin This matches the behavior of other browsers (in fact, I filed [1] about it long time ago). This avoids a bunch of overhead in some speedometer subtests. Makes me a bit sad because I still think our approach is slightly more correct per spec, but not worth the performance cost. [1]: w3c/csswg-drafts#2263 Differential Revision: https://phabricator.services.mozilla.com/D190705
…shin This matches the behavior of other browsers (in fact, I filed [1] about it long time ago). This avoids a bunch of overhead in some speedometer subtests. Makes me a bit sad because I still think our approach is slightly more correct per spec, but not worth the performance cost. [1]: w3c/csswg-drafts#2263 Differential Revision: https://phabricator.services.mozilla.com/D190705
…shin This matches the behavior of other browsers (in fact, I filed [1] about it long time ago). This avoids a bunch of overhead in some speedometer subtests. Makes me a bit sad because I still think our approach is slightly more correct per spec, but not worth the performance cost. [1]: w3c/csswg-drafts#2263 Differential Revision: https://phabricator.services.mozilla.com/D190705 UltraBlame original commit: e136cc9893278df1df3e3b997b9e6756122b9c44
…shin This matches the behavior of other browsers (in fact, I filed [1] about it long time ago). This avoids a bunch of overhead in some speedometer subtests. Makes me a bit sad because I still think our approach is slightly more correct per spec, but not worth the performance cost. [1]: w3c/csswg-drafts#2263 Differential Revision: https://phabricator.services.mozilla.com/D190705 UltraBlame original commit: e136cc9893278df1df3e3b997b9e6756122b9c44
…shin This matches the behavior of other browsers (in fact, I filed [1] about it long time ago). This avoids a bunch of overhead in some speedometer subtests. Makes me a bit sad because I still think our approach is slightly more correct per spec, but not worth the performance cost. [1]: w3c/csswg-drafts#2263 Differential Revision: https://phabricator.services.mozilla.com/D190705 UltraBlame original commit: e136cc9893278df1df3e3b997b9e6756122b9c44
…shin This matches the behavior of other browsers (in fact, I filed [1] about it long time ago). This avoids a bunch of overhead in some speedometer subtests. Makes me a bit sad because I still think our approach is slightly more correct per spec, but not worth the performance cost. [1]: w3c/csswg-drafts#2263 Differential Revision: https://phabricator.services.mozilla.com/D190705
Should the following test-case be brown or yellow?
Right now Gecko is yellow, blink / webkit are brown.
The text was updated successfully, but these errors were encountered: