Re: [csswg-drafts] [selectors] :link and :visited are not mutually exclusive in implementations

@victoriasu So, I just want to take an opportunity to clarify my thinking.

I do believe that if we keep the spec text as it is today, we should at the very least add a note mentioning that for most properties, :link will apply regardless of visited status, and point to [DBaron's spec]( I understand @dbaron's point of view that says that, for the purpose of the selector matching, :link and :visited are mutually exclusive (as in you cannot ever have :link:visited match), I just think that for an author reading the spec, it is important to understand that :link will, in practice, match all links except for a few select properties.

To return to the interop issue highlighted in the first post of this thread:

Globally, how it works in Edge is we kinda have a "color" and a "visited-color" property, and when a style rule applies "color:red" we set both of them; if the style came from a :visited rule however, we only set "visited-color" (we do this for a limited subset of properties, for other properties, a visited rule will not set anything when applied; converserly, when a rule contains :link we should only set the non-visited property, though whether we do this for all properties is unclear). This means that :link applies all the times for most properties, and does not apply for properties for which we got the ":link sets only non-visited field" rule right (when we do not :visited rules are still allowed to override these :link declarations that also happen to have set the visited-property, they just need higher specificity).

It looks like `background-color` is a property for which we didn't get the ":link does not set the :visited part" right, hence the interop difference in the demo above. For all other properties I tested, we behave like other browsers, so it is just a bug on us to fix this issue.

To conclude, I think as a result of this, only an editorial change should be necessary: adding a note to the spec would be great, if only because the current text caused enough confusion for browser engineers to file this issue in the first place.

GitHub Notification of comment by FremyCompany
Please view or discuss this issue at using your GitHub account

Received on Thursday, 7 December 2017 04:27:23 UTC