Skip to content
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

[selectors] Should empty string link match :visited? #2884

Closed
Loirooriol opened this issue Jul 5, 2018 · 6 comments

Comments

Projects
None yet
5 participants
@Loirooriol
Copy link
Collaborator

commented Jul 5, 2018

Should this match :visited?

<a href="">Link</a>

An empty URL points to the base URL, so assuming there is no <base> and history is enabled, I guess :visited should match.

However, there are various WPT tests like https://github.com/web-platform-tests/wpt/blob/6562ed003eebcd25d093ae52d68de28a0ae0d786/css/CSS2/selectors/link-visited-selector-001.xht which are manual. If the above is supposed to work, why not make them automated by linking the current page?

And Edge seems to have some weird bugs, like <a href=""> matching :visited in jsfiddle but not in jsbin. However, this seems to work everywhere:

document.querySelector('a').href = location.href

So can you confirm that this is supposed to work?

@mrego mrego added the selectors-4 label Jul 6, 2018

@tigt

This comment has been minimized.

Copy link

commented Jul 9, 2018

Could you link to the jsbin you mentioned? It may append a cachebusting querystring to its preview <iframe>, causing <a href=""> to expand to a URL the browser hasn’t visited.

@Loirooriol

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 9, 2018

The jsbin was http://jsbin.com/kuhaxer/1/edit?html,css,output

However, I also tried a plain local HTML file (both with file:// and http://localhost/) and :visited didn't match.

However, it matched in https://jsfiddle.net/9f1eqyon/1/

@fantasai

This comment has been minimized.

Copy link
Collaborator

commented Nov 14, 2018

Yes. There's nothing special about href="", as long as it points to the current page (depends on the BASE tag), it should be considered visible. I can't seem to duplicate your problems here -- the jsbin works, local files containing

<a href="">test.html</a>
<a href="test2.html">test2.html</a>

work as expected. So closing out the issue as invalid.

@fantasai

This comment has been minimized.

Copy link
Collaborator

commented Nov 14, 2018

Ohyeah, the reason the tests there are manual are because all tests during CSS2 development were manual: we didn't have an automation system, so there wasn't a perceived benefit in making them automatable. :) Now that we have automation systems, it would be fine to update them to be automated.

@Loirooriol

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 14, 2018

@emilio

This comment has been minimized.

Copy link
Collaborator

commented Nov 14, 2018

Note that IIRC in Gecko visited link coloring is async even if href is empty.

We could probably special-case the href="" case, somehow to have deterministic output for reftests... WDYT @dbaron?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.