On 07/06/2010 12:24 PM, Christopher Wells wrote: > On Tue, Jul 6, 2010 at 2:03 PM, Philippe Wittenbergh<[email protected]> wrote: >> >> 16.6.1 "The 'white-space' processing model" provides the answer >> <http://www.w3.org/TR/CSS21/text.html#white-space-model> >> (second list) > > Is that the way in which whitespace between blocks is removed? Is the > whitespace only removed (or rather, hidden or not displayed) by the > CSS/layout/rendering process, and not removed by the HTML/parsing/DOM > process?
It depends on the implementation and the tags involved (and I believe the HTML5 spec will clarify what exactly is supposed to happen here), but in general, yes, it is removed at the CSS level. >> Again, refer to 16.6.1, more particularly, the first ordered list, point 4.2 > > So the following are all valid and display identically: > > `<p>The <strong> lazy </strong> dog.</p>` > > `<p>The <strong>lazy</strong> dog.</p>` > > `<p>The<strong> lazy </strong>dog.</p>` No, they will not render identically. The space that is preserved when spaces are collapsed is the first space in the sequence of collapsible spaces. If you put borders on the <strong> you will see that the space after "The" is outside the <strong> in the first two cases, and inside it in the last. Similarly, the space after "lazy" is inside the <strong> in the first and third cases, but not in the second one. (If the <strong> has no styling, then it will render identically.) > And the reason why they're the same is that the consecutive spaces are > collapsed (even when they belong to different/adjacent inline text > runs). Yes. > Do text nodes in the parsed DOM still contain all the original > whitespace characters? For example, do the text nodes have values like > "The " and " lazy "? Yes. CSS does not affect the DOM. It reads from it, but does not alter it. > Do the DOM Node.normalize() and Document.normalizeDocument() have any > effect on the whitespace: do they trim, collapse or remove extraneous > whitespace from the text nodes? I don't know. ~fantasai ______________________________________________________________________ css-discuss [[email protected]] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
