Files
firefox/testing/web-platform/tests/css/css-properties-values-api/conditional-rules.html
T
Anders Hartvoll Ruud bd49dc90f0 Bug 1557340 [wpt PR 16772] - [css-properties-values-api] CSS.supports(property, value) behavior., a=testonly
Automatic update from web-platform-tests
[css-properties-values-api] CSS.supports(property, value) behavior.

The two-parameter version of CSS.supports should return false if the
value does not parse for the registered syntax of the property.

BUG=641877
[email protected]

Change-Id: I7a3ccbbd8ad465132bb44348919db19e837b5dd7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1604268
Reviewed-by: Rune Lillesveen <[email protected]>
Commit-Queue: Anders Hartvoll Ruud <[email protected]>
Cr-Commit-Position: refs/heads/master@{#659919}

--

wp5At-commits: d7afcb8708eac08a614d161d5622a48172daf7e3
wpt-pr: 16772
2019-06-19 11:05:26 -07:00

43 lines
1.1 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_false(CSS.supports('--length', 'red'));
assert_true(CSS.supports('--length', '10px'));
}, 'CSS.supports(property, value) should parse against registered syntax');
</script>