File: white-space-collapse-001.html

package info (click to toggle)
thunderbird 1%3A115.16.0esr-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,476,252 kB
  • sloc: cpp: 6,972,150; javascript: 5,209,211; ansic: 3,507,222; python: 1,137,609; asm: 432,531; xml: 205,149; java: 175,761; sh: 116,485; makefile: 22,152; perl: 13,971; objc: 12,561; yacc: 4,583; pascal: 2,840; lex: 1,720; ruby: 1,075; exp: 762; sql: 666; awk: 580; php: 436; lisp: 430; sed: 70; csh: 10
file content (66 lines) | stat: -rw-r--r-- 4,039 bytes parent folder | download | duplicates (30)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html  lang="en" >
<head>
<meta charset="utf-8">
<title>White space and non-ASCII spaces</title>
<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
<meta name="assert" content="Any space immediately following another collapsible space is collapsed to have zero advance width. Only refers to U+0020, not other Unicode spaces.">
<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 id='testNB' class="test"><span>hello&#x20;&#x20;&#x20;&#x00A0;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
<div id="refNB" class="ref"><span>hello&#x20;&#x00A0;&#x20;there</span></div>
<div id='testEN' class="test"><span>hello&#x20;&#x20;&#x20;&#x2002;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
<div id="refEN" class="ref"><span>hello&#x20;&#x2002;&#x20;there</span></div>
<div id='testEM' class="test"><span>hello&#x20;&#x20;&#x20;&#x2003;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
<div id="refEM" class="ref"><span>hello&#x20;&#x2003;&#x20;there</span></div>
<div id='testTS' class="test"><span>hello&#x20;&#x20;&#x20;&#x2009;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
<div id="refTS" class="ref"><span>hello&#x20;&#x2009;&#x20;there</span></div>
<div id='testZW' class="test"><span>hello&#x20;&#x20;&#x20;&#x200B;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
<div id="refZW" class="ref"><span>hello&#x20;&#x200B;&#x20;there</span></div>
<div id='testNNB' class="test"><span>hello&#x20;&#x20;&#x20;&#x202F;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
<div id="refNNB" class="ref"><span>hello&#x20;&#x202F;&#x20;there</span></div>
<div id='testIS' class="test"><span>hello&#x20;&#x20;&#x20;&#x00A0;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;there</span></div>
<div id="refIS" class="ref"><span>hello&#x20;&#x00A0;&#x20;there</span></div>
<div id='testIS2' class="test"><span>缔造真正全球通行&#x20;&#x20;&#x20;&#x00A0;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;的万维网</span></div>
<div id="refIS2" class="ref"><span>缔造真正全球通行&#x20;&#x00A0;&#x20;的万维网</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>