Source code

Revision control

Other Tools

Test Info:

<!DOCTYPE html>
<script type="text/javascript" src="/resources/testharness.js"></script>
<script type="text/javascript" src="/resources/testharnessreport.js"></script>
<script type="text/javascript" src="resources/matchmedia-utils.js"></script>
<script>
query_should_be_css_parseable("(prefers-color-scheme)");
query_should_be_css_parseable("(prefers-color-scheme: light)");
query_should_be_css_parseable("(prefers-color-scheme: dark)");
query_should_not_be_css_parseable("(prefers-color-scheme: 0)");
query_should_not_be_css_parseable("(prefers-color-scheme: none)");
query_should_not_be_css_parseable("(prefers-color-scheme: 10px)");
query_should_not_be_css_parseable("(prefers-color-scheme: dark 0)");
query_should_not_be_css_parseable("(prefers-color-scheme: dark light)");
query_should_not_be_css_parseable("(prefers-color-scheme: light/dark)");
query_should_not_be_css_parseable("(prefers-color-scheme: no-preference)");
query_should_be_js_parseable("(prefers-color-scheme)");
query_should_be_js_parseable("(prefers-color-scheme: light)");
query_should_be_js_parseable("(prefers-color-scheme: dark)");
query_should_not_be_js_parseable("(prefers-color-scheme: 0)");
query_should_not_be_js_parseable("(prefers-color-scheme: none)");
query_should_not_be_js_parseable("(prefers-color-scheme: 10px)");
query_should_not_be_js_parseable("(prefers-color-scheme: dark 0)");
query_should_not_be_js_parseable("(prefers-color-scheme: dark light)");
query_should_not_be_js_parseable("(prefers-color-scheme: light/dark)");
query_should_not_be_js_parseable("(prefers-color-scheme: no-preference)");
test(() => {
let booleanContext = window.matchMedia("(prefers-color-scheme)");
assert_true(booleanContext.matches);
}, "Check that prefer-color-scheme evaluates to true in the boolean context");
</script>