Skip to content

Commit

Permalink
Update <link> pseudo selector WPTs
Browse files Browse the repository at this point in the history
In these spec PRs [1][2], the <link> element will no longer match :link,
:visited, or :any-link, and it will no longer navigate the page when
clicked.

This patch also modifies the TestExpectations for one of the modified
tests navigation.sub.html. There was one test case which was
consistently timing out which I removed, which would stop the test from
timing out. However, there are an additional two test cases which time
out when run with run_web_tests.py but pass just fine with
run_wpt_tests.py. In addition, the flags passed to run_web_tests.py on
the trybots make it so that those two test cases which time out get
written to a failure file instead of making the whole test runner time
out, which would count as a failure in TestExpectations. Since the
default flags for run_web_tests.py make it an actual timeout according to
TestExpectations, I left the timeout expectation in there as well.

Hopefully this test can just be run with run_wpt_tests.py in the future
and we can get rid of this TestExpectation.

[1] whatwg/html#6269
[2] w3c/csswg-drafts#5839

Bug: 611093
Change-Id: I7234eb6024450e28c1ca6ec1ede7fdfc8f2ece52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628037
Reviewed-by: Domenic Denicola <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Commit-Queue: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/master@{#844921}
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Jan 19, 2021
1 parent dd8c3e3 commit 7fb7957
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dom/nodes/selectors.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,42 @@
}, 'follow hyperlink <'+tag+' href>');
}

'a, area, link'.split(', ').forEach(function(str) {
'a, area'.split(', ').forEach(function(str) {
test_follow_link(str);
});

async_test(function() {
const iframe = document.createElement('iframe');
iframe.name = 'test_dont_follow_link';
document.body.appendChild(iframe);

const link = document.createElement('link');
link.target = iframe.name;
link.setAttribute('href', input_url_html);
document.body.appendChild(link);

const anchor = document.createElement('a');
anchor.target = iframe.name;
anchor.setAttribute('href', blank);
document.body.appendChild(anchor);

this.add_cleanup(function() {
iframe.remove();
link.remove();
anchor.remove();
});

iframe.onload = this.step_func_done(() => {
assert_equals(
iframe.contentDocument.location.pathname,
'/html/infrastructure/urls/resolving-urls/query-encoding/resources/blank.py',
'The <a> navigation should occur instead of the <link> navigation.');
});

anchor.click();
link.click();
}, `don't follow hyperlink <link href>`);

// follow hyperlink with ping attribute
function test_follow_link_ping(tag) {
async_test(function() {
Expand Down
5 changes: 1 addition & 4 deletions html/semantics/selectors/pseudo-classes/link.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@
<a href="http://[" id=link10></a>

<script>
testSelectorIdsMatch(":link", ["link1", "link2", "link3", "link7", "link8", "link9", "link10"], "Only <a>s, <area>s and <link>s that have a href attribute match ':link'");

document.getElementById("link9").removeAttribute("href");
testSelectorIdsMatch(":link", ["link1", "link2", "link3", "link7", "link8", "link10"], "':link' doesn't match elements whos href attribute has been removed");
testSelectorIdsMatch(":link", ["link7", "link8", "link10"], "Only <a>s and <area>s that have a href attribute match ':link'");
</script>

0 comments on commit 7fb7957

Please sign in to comment.