fune/testing/web-platform/tests/css/css-properties-values-api/conditional-rules.html
Anders Hartvoll Ruud f56f7234e8 Bug 1568161 [wpt PR 17998] - [css-properties-values-api] CSS.supports should ignore syntax after all., a=testonly
Automatic update from web-platform-tests
[css-properties-values-api] CSS.supports should ignore syntax after all.

According to a recent spec change, the syntax of a registered custom
property must be ignored until computed-value time. This means that
CSS.supports must treat all custom properties as unregistered.

This effectively reverts 9646ae2d0269da525804f2d60c6c0380e754bd3f (except
the test).

Bug: 641877
Change-Id: I6d24fc23534636b88167121b73b28455f563d501
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713508
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#679986}

--

wpt-commits: 151e5cc98d40a21d6f1202a2e5fc8d464722f475
wpt-pr: 17998
2019-07-31 02:54:02 +00:00

43 lines
1.2 KiB
HTML

<!DOCTYPE html>
<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api-1/#conditional-rules">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
CSS.registerProperty({
name: '--length',
syntax: '<length>',
initialValue: '0px',
inherits: false
});
</script>
<style>
#target { color: red; }
@supports(--length: green) {
#target { color: rgb(1, 2, 3); }
}
</style>
<div id=target></div>
<script>
test(function() {
let cs = getComputedStyle(target);
assert_equals(cs.getPropertyValue('color'), 'rgb(1, 2, 3)');
}, '@supports should ignore registered syntax');
test(function() {
assert_true(CSS.supports('--length: red'));
assert_true(CSS.supports('--length: 10px'));
assert_true(CSS.supports('--length: anything, really'));
}, 'CSS.supports(conditionText) should ignore registered syntax');
test(function() {
assert_true(CSS.supports('--length', 'red'));
assert_true(CSS.supports('--length', '10px'));
assert_true(CSS.supports('--length', ' anything, really'));
}, 'CSS.supports(property, value) should ignore registered syntax');
</script>