Bug 1436398 [wpt PR 9416] - New :matches() wpt, a=testonly

Automatic update from web-platform-tests
This new :matches() wpt does not require invalidation for testing.

Change-Id: If6d09353b967bf0486f9ecadb3f23d337b99a261
Reviewed-on: https://chromium-review.googlesource.com/905705
Commit-Queue: Victoria Su <victoriaytsu@google.com>
Reviewed-by: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534930}

<!-- Reviewable:start -->

<!-- Reviewable:end -->

wpt-commits: 660249e6e7e47b0e679ac53f00c86106aaea8c55
wpt-pr: 9416

reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2, b81999f30c1516a70c153de51a0331d14c8faead
This commit is contained in:
Victoria Su 2018-03-06 17:20:29 +00:00 committed by moz-wptsync-bot
parent 15e91f4b72
commit 951ffc810b
3 changed files with 133 additions and 0 deletions

View File

@ -315006,6 +315006,18 @@
{}
]
],
"css/selectors/matches-nested.html": [
[
"/css/selectors/matches-nested.html",
{}
]
],
"css/selectors/matches-specificity.html": [
[
"/css/selectors/matches-specificity.html",
{}
]
],
"css/selectors/missing-right-token.html": [
[
"/css/selectors/missing-right-token.html",
@ -528543,6 +528555,14 @@
"d23ac4f08cb0c70d06bfac4c4be121a8de8af48f",
"reftest"
],
"css/selectors/matches-nested.html": [
"fbfe269916b375d5dea97ba7c76ed75ccaf2dc4c",
"testharness"
],
"css/selectors/matches-specificity.html": [
"89f8fd14f1faa838d60e4b047c501f6c08de0b42",
"testharness"
],
"css/selectors/missing-right-token.html": [
"d961e801f7df57161cd8c7b5a4b26ae24013c3e9",
"testharness"

View File

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Selectors: :matches()</title>
<link rel="author" title="Victoria Su" href="mailto:victoriaytsu@google.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#matches">
<meta name="assert" content="This tests that the :matches() selector is effective when nested">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
/* Testing that highest specificity is chosen for class outside of :matches() */
.a+.b+.c>.e+.d {
color: black;
font-size: 10px;
width: 10px;
}
.a+:matches(.b+.f, .b+:matches(*, .c>.e, .g, *))+.d {
color: red;
font-size: 20px;
}
.a+.b+.c>.e+.d {
color: yellow;
}
/* Testing specificty of a class within :matches() */
.a+.c>.e {
color: black;
}
.a+:matches(.b+.f, :matches(.c>.e, .g)) {
color: red;
}
.c>.e {
color: black;
}
</style>
</head>
<body>
<div class="a">
</div>
<div class="b" id="b2">
</div>
<div class="c" id="c2">
<div class="e">
</div>
<div class="d" id="d1">
Yellow
</div>
</div>
<div class="a">
</div>
<div class="c" id="c2">
<div class="e" id="e1">
Red
</div>
</div>
<script>
var red = "rgb(255, 0, 0)";
var yellow = "rgb(255, 255, 0)";
test(() => {
assert_equals(getComputedStyle(d1).color, yellow);
assert_equals(getComputedStyle(d1).fontSize, "20px");
assert_equals(getComputedStyle(d1).width, "10px");
}, "Test nested :matches() chooses highest specificity for class outside :matches().");
test(() => {
assert_equals(getComputedStyle(e1).color, red);
}, "Test nested :matches() specificity for class within arguments.");
</script>
</body>
</html>

View File

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Selectors: :matches()</title>
<link rel="author" title="Victoria Su" href="mailto:victoriaytsu@google.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#matches">
<meta name="assert" content="This tests that the :matches() selector chooses the correct specificity">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.b.c + .d + .q.r + .s + #target {
font-size: 10px;
height: 10px;
width: 10px;
}
:matches(.a, .b.c + .d, .e) + :matches(* + .p, .q.r + .s, * + .t) + #target {
height: 20px;
width: 20px;
}
.b.c + .d + .q.r + .s + #target {
width: 30px;
}
</style>
</head>
<body>
<div class="b c"></div>
<div class="a d e"></div>
<div class="q r"></div>
<div class="p s t"></div>
<div id="target"></div>
<script>
test(() => {
assert_equals(getComputedStyle(target).width, "30px");
assert_equals(getComputedStyle(target).height, "20px");
assert_equals(getComputedStyle(target).fontSize, "10px");
}, "Test :matches() uses highest possible specificity");
</script>
</body>
</html>