servo/tests/wpt/css-tests/css-text-3_dev/xhtml1/white-space-collapse-001.xht

66 lines
No EOL
3.6 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head>
<meta charset="utf-8" />
<title>White space and non-ASCII spaces</title>
<link href="mailto:ishida@w3.org" rel="author" title="Richard Ishida" />
<link href="https://drafts.csswg.org/css-text-3/#line-break-transform" rel="help" />
<meta content="Any space immediately following another collapsible space is collapsed to have zero advance width. Only refers to U+0020, not other Unicode spaces." name="assert" />
<style type="text/css">
.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<div class="test" id="testNB"><span>hello &#xA0; there</span></div>
<div class="ref" id="refNB"><span>hello &#xA0; there</span></div>
<div class="test" id="testEN"><span>hello &#x2002; there</span></div>
<div class="ref" id="refEN"><span>hello &#x2002; there</span></div>
<div class="test" id="testEM"><span>hello &#x2003; there</span></div>
<div class="ref" id="refEM"><span>hello &#x2003; there</span></div>
<div class="test" id="testTS"><span>hello &#x2009; there</span></div>
<div class="ref" id="refTS"><span>hello &#x2009; there</span></div>
<div class="test" id="testZW"><span>hello &#x200B; there</span></div>
<div class="ref" id="refZW"><span>hello &#x200B; there</span></div>
<div class="test" id="testNNB"><span>hello &#x202F; there</span></div>
<div class="ref" id="refNNB"><span>hello &#x202F; there</span></div>
<div class="test" id="testIS"><span>hello &#xA0; there</span></div>
<div class="ref" id="refIS"><span>hello &#xA0; there</span></div>
<div class="test" id="testIS2"><span>缔造真正全球通行 &#xA0; 的万维网</span></div>
<div class="ref" id="refIS2"><span>缔造真正全球通行 &#xA0; 的万维网</span></div>
<script>
test(function() {
assert_equals(document.getElementById('testNB').firstChild.offsetWidth, document.getElementById('refNB').firstChild.offsetWidth);
}, "no-break space");
test(function() {
assert_equals(document.getElementById('testEN').firstChild.offsetWidth, document.getElementById('refEN').firstChild.offsetWidth);
}, "en space");
test(function() {
assert_equals(document.getElementById('testEM').firstChild.offsetWidth, document.getElementById('refEM').firstChild.offsetWidth);
}, "em space");
test(function() {
assert_equals(document.getElementById('testTS').firstChild.offsetWidth, document.getElementById('refTS').firstChild.offsetWidth);
}, "thin space");
test(function() {
assert_equals(document.getElementById('testZW').firstChild.offsetWidth, document.getElementById('refZW').firstChild.offsetWidth);
}, "zero width space");
test(function() {
assert_equals(document.getElementById('testZW').firstChild.offsetWidth, document.getElementById('refZW').firstChild.offsetWidth);
}, "narrow no-break space");
test(function() {
assert_equals(document.getElementById('testIS').firstChild.offsetWidth, document.getElementById('refIS').firstChild.offsetWidth);
}, "ideographic space");
test(function() {
assert_equals(document.getElementById('testIS2').firstChild.offsetWidth, document.getElementById('refIS2').firstChild.offsetWidth);
}, "ideographic space inside ideographic text");
</script>
<!-- Notes:
The assertion will fail if space is produced for any line in the test paragraph.
-->
</body></html>