Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 12 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-typed-om/factory-font-relative-length.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>CSSOM Test: Numeric Factory Functions for font relative length</title>
<meta name="assert" content="CSS factory functions produce expected CSSUnitValue">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
"use strict";
let units = [
"cap",
"ch",
"em",
"ex",
"ic",
"lh",
"rcap",
"rch",
"rem",
"rex",
"ric",
"rlh"
];
let counter = 1;
for (let unit of units) {
test(function(){
let length = CSS[unit](counter);
assert_true(length instanceof CSSUnitValue);
assert_equals(length.value, counter);
assert_equals(length.unit, unit);
counter++;
}, `CSS.${unit}() produces ${unit} length`);
}
</script>
</body>
</html>