Skip to content

Commit bc1c54d

Browse files
Steinar H. Gundersonchromium-wpt-export-bot
authored andcommitted
Fix a crash with empty @contents blocks.
Also fixed a typo in the test while we were on it. Fixed: 442735990 Change-Id: I4c448272bd9bfeef04ba0be60d9ccef751516d85 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6919119 Reviewed-by: Anders Hartvoll Ruud <[email protected]> Auto-Submit: Steinar H Gunderson <[email protected]> Commit-Queue: Steinar H Gunderson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1511504}
1 parent 59f74a9 commit bc1c54d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

css/css-mixins/contents-rule.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,17 @@
4646
@contents { color: red !important; }
4747
color: green;
4848
}
49-
#e4 {
49+
#e5 {
5050
@apply --m5 { color: red !important; }
5151
}
52+
53+
@mixin --m6(@contents) {
54+
@contents { }
55+
color: green;
56+
}
57+
#e6 {
58+
@apply --m6;
59+
}
5260
</style>
5361
</head>
5462
<body>
@@ -57,6 +65,7 @@
5765
<div class="a b" id="e3">This text should be green.</div>
5866
<div class="c d" id="e4">This text should be green.</div>
5967
<div id="e5">This text should be green.</div>
68+
<div id="e6">This text should be green.</div>
6069
<script>
6170
test(() => {
6271
let target = document.getElementById('e1');
@@ -82,6 +91,11 @@
8291
let target = document.getElementById('e5');
8392
assert_equals(getComputedStyle(target).color, 'rgb(0, 128, 0)');
8493
}, '@contents is ignored if there is no @contents parameter');
94+
95+
test(() => {
96+
let target = document.getElementById('e6');
97+
assert_equals(getComputedStyle(target).color, 'rgb(0, 128, 0)');
98+
}, 'Empty @contents block is allowed, but does nothing');
8599
</script>
86100
</body>
87101
</html>

0 commit comments

Comments
 (0)