@@ -1280,28 +1280,48 @@ Order of Operations</h4>
1280
1280
<h2 id="white-space-processing">
1281
1281
White Space Processing Details</h2>
1282
1282
1283
- <p> The source text of a document often contains formatting
1283
+ The source text of a document often contains formatting
1284
1284
that is not relevant to the final rendering: for example,
1285
1285
<a href="http://rhodesmill.org/brandon/2012/one-sentence-per-line/">breaking the source into segments</a>
1286
1286
(lines) for ease of editing
1287
1287
or adding [=white space characters=] such as [=tabs=] and [=spaces=] to indent the source code.
1288
1288
CSS white space processing allows the author to control interpretation of such formatting:
1289
1289
to preserve or collapse it away when rendering the document.
1290
- White space processing in CSS interprets [=white space characters=] only for rendering:
1290
+ White space processing in CSS
1291
+ (which is controlled with the 'white-space' property)
1292
+ interprets [=white space characters=] only for rendering:
1291
1293
it has no effect on the underlying document data.
1292
1294
1293
- <p> White space processing in CSS is controlled with the 'white-space' property.
1295
+ Note: Depending on the document language,
1296
+ segments can be separated by a particular newline sequence
1297
+ (such as a line feed or CRLF pair),
1298
+ or delimited by some other mechanism,
1299
+ such as the SGML <code> RECORD-START</code> and <code> RECORD-END</code> tokens.
1294
1300
1295
- <p id="segment-normalization">
1296
- CSS does not define document segmentation rules. Segments can be
1297
- separated by a particular newline sequence (such as a line feed or
1298
- CRLF pair), or delimited by some other mechanism, such as the SGML
1299
- <code> RECORD-START</code> and <code> RECORD-END</code> tokens.
1300
- For CSS processing, each document language–defined segment break
1301
- and each line feed (U+000A)
1301
+ <p id="segment-normalization">
1302
+ For CSS processing, each document language–defined “segment break” or “newline sequence”--
1303
+ or if none are defined, each line feed (U+000A)--
1302
1304
in the text is treated as a <dfn export>segment break</dfn> ,
1303
1305
which is then interpreted for rendering as specified by the 'white-space' property.
1304
1306
1307
+ In the case of [[HTML]] ,
1308
+ each <a href="https://html.spec.whatwg.org/#newlines">newline sequence is normalized</a> to a single line feed (U+000A)
1309
+ for representation in the DOM,
1310
+ so when an HTML document is represented as a [[DOM]] tree
1311
+ each line feed (U+000A)
1312
+ is treated as as a [=segment break=] .
1313
+
1314
+ Note: In most common CSS implementations,
1315
+ HTML does not get styled directly.
1316
+ Instead, it is processed into a [[DOM]] tree,
1317
+ which is then styled.
1318
+ Unlike HTML,
1319
+ the DOM does not give any particular meaning to carriage returns (U+000D),
1320
+ so they are not treated as [=segment breaks=] .
1321
+ If carriage returns (U+000D) are inserted into the DOM
1322
+ by means other than HTML parsing,
1323
+ they then get treated as defined below.
1324
+
1305
1325
<wpt pathprefix="/css/CSS2/text">
1306
1326
white-space-processing-005.xht
1307
1327
white-space-processing-006.xht
0 commit comments