mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-15 07:32:52 +00:00
Checking that the string parsed for the `font` property is not enough, the spec also wants to rule out CSS-wide keywords like `inherit`. The simplest way to do so is to check if it's a ShorthandStyleValue, which also rules out use of `var()`; this matches other browsers' behaviour. The newly-added test would previously crash, and now doesn't. :^)
15 lines
579 B
HTML
15 lines
579 B
HTML
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
let canvas = document.createElement("canvas");
|
|
let context = canvas.getContext("2d");
|
|
context.font = '20px SerenitySans';
|
|
println(context.font);
|
|
context.font = 'inherit'; // CSS-wide keywords are not allowed
|
|
println(context.font);
|
|
context.font = 'var(--font-size, 30px) Arial'; // Variables are not allowed here
|
|
println(context.font);
|
|
context.font = '!!!'; // Invalid value, should be ignored.
|
|
println(context.font);
|
|
});
|
|
</script>
|