Bug 142734 - :not(:link) and :not(:visited) don't match <a name="foo">
Summary: :not(:link) and :not(:visited) don't match <a name="foo">
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: data:text/html,<style>a { color: red ...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-16 10:52 PDT by Adam Roben (:aroben)
Modified: 2022-07-24 13:53 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2015-03-16 10:52:19 PDT
1. Go to data:text/html,<style>a { color: red } a:not(:link) { color: green }</style><a name="foo">should be green</a>

In Chrome and Firefox, the text is green. In Safari 8.0.3 on Yosemite, it is red. (I haven't tested other versions/OSes.)
Comment 1 Adam Roben (:aroben) 2015-03-16 11:02:18 PDT
Looks like :not(:visited) also does not match <a name="foo">. Try with this URL:

data:text/html,<style>a { color: red } a:not(:visited) { color: green }</style><a name="foo">should be green</a>
Comment 2 Benjamin Poulain 2015-03-16 11:14:22 PDT
We removed support for :link and :visited inside :not() when we extended :not() to Level 4.
Comment 3 Benjamin Poulain 2015-03-16 11:18:42 PDT
I should probably explain why a bit :)

Previously, we could find out statically if a selector applies to :link or :visited. Since we added support for nested selector lists, it is no longer possible to know the "link-state" of a selector until it is matched.

Because of the privacy risks involved with dynamic resolution, we decided against it.

If you have good use cases for it, we can look into adding support back. But that's gonna be weeks of work.
Comment 4 Adam Roben (:aroben) 2015-03-16 11:22:55 PDT
I don't have a use case for this at the moment. I just noticed it while working on filing bug 142737. I'd be OK with closing this.
Comment 5 Benjamin Poulain 2015-03-16 11:34:27 PDT
(In reply to comment #4)
> I don't have a use case for this at the moment. I just noticed it while
> working on filing bug 142737. I'd be OK with closing this.

Let's keep the bug report open, it is a valid bug, just not very high priority right now.
Comment 6 Ahmad Saleem 2022-07-24 10:43:53 PDT
I changed the test cases into below:

Comment 0 - JSFiddle - https://jsfiddle.net/hbm41689/show

Comment 1 - JSFiddle - https://jsfiddle.net/v7z84sp3/show


In both above, all browsers (Chrome Canary 106, Firefox Nightly 104 and Safari 15.6 on macOS 12.5 show the text as "GREEN".

Since all browsers are matching each other, I think this can be marked as "RESOLVED WONTFIX" or "RESOLVED CONFIGURATION CHANGED" etc., if I am testing incorrectly or web-spec dictates something else then please retest accordingly. Thanks!