Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-fonts/font-family-comma.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>Font family names with comma</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="div"></div>
<script>
"use strict";
const div = document.getElementById("div");
test(t => {
t.add_cleanup(() => {
div.style.fontFamily = "";
});
div.style.fontFamily = "Arial,";
assert_equals(div.style.fontFamily, "");
}, "Comma after");
test(t => {
t.add_cleanup(() => {
div.style.fontFamily = "";
});
div.style.fontFamily = ",Arial";
assert_equals(div.style.fontFamily, "");
}, "Comma before");
test(t => {
t.add_cleanup(() => {
div.style.fontFamily = "";
});
div.style.fontFamily = "Arial,Arial";
assert_equals(div.style.fontFamily, "Arial, Arial");
}, "Comma in between");
test(t => {
t.add_cleanup(() => {
div.style.fontFamily = "";
});
div.style.fontFamily = ",,";
assert_equals(div.style.fontFamily, "");
}, "Only commas");
test(t => {
t.add_cleanup(() => {
div.style.fontFamily = "";
});
div.style.fontFamily = '"Arial,"';
assert_equals(div.style.fontFamily, '"Arial,"');
}, "Quoted comma");
</script>