Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-page/parsing/size-invalid.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// size is a property and a descriptor. Property-only values
// used as the @page descriptor should be invalid.
function test_invalid_descriptor(value) {
test(() => {
const style = document.createElement("style");
document.head.append(style);
try {
const sheet = style.sheet;
sheet.insertRule(`@page { size: ${value}; }`);
assert_equals(sheet.cssRules[0].style.getPropertyValue("size"), "",
`size: ${value} should be invalid as an @page descriptor`);
} finally {
style.remove();
}
}, `@page { size: ${value} } is invalid`);
}
test_invalid_descriptor("50%");
test_invalid_descriptor("10px 50%");
test_invalid_descriptor("min-content");
test_invalid_descriptor("max-content");
test_invalid_descriptor("fit-content(100px)");
test_invalid_descriptor("min-content max-content");
</script>