-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathmixin-media-query-invalidation-2.html
More file actions
39 lines (38 loc) · 1.17 KB
/
mixin-media-query-invalidation-2.html
File metadata and controls
39 lines (38 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<head>
<title>CSS Mixins: Invalidates on negative media query becoming positive</title>
<link rel="help" href="https://drafts.csswg.org/css-mixins/#mixin-rule">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<iframe id="iframe" width="500" height="300" srcdoc="
<style>
@mixin --m1() {
color: red;
}
@media (width < 50px) {
@mixin --m1() {
color: green;
}
}
</style>
<style>
/* Invalidated by a mixin in a different style sheet. */
#target {
@apply --m1;
}
</style>
<div id='target'>This text should be green once narrowed.</div>
"></iframe>
<script>
promise_test(async () => {
await new Promise(r => iframe.addEventListener('load', r));
let target = iframe.contentDocument.getElementById('target');
assert_equals(getComputedStyle(target).color, "rgb(255, 0, 0)");
iframe.width = 30;
assert_equals(getComputedStyle(target).color, "rgb(0, 128, 0)");
});
</script>
</body>
</html>