Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel=author href="mailto:jkew@mozilla.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#t, #r {
font: 20px/1 monospace;
letter-spacing: 2ch;
overflow-wrap: anywhere;
outline: 1px solid black;
margin: 10px;
}
</style>
<script>
function run() {
let refWidth = r.offsetWidth;
test(() => assert_less_than(t.offsetWidth, refWidth, "test div should have smaller width"));
t.style.width = "max-content";
test(() => assert_equals(t.offsetWidth, refWidth, "widths should now match"));
}
</script>
</head>
<body onload="run()">
<div id="r" style="width: max-content;">
aaaaa<i></i>bbb
</div>
<div id="t" style="width: 15ch;">
aaaaa<i></i>bbb
</div>