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)
Are you saying then, about whitespace between blocks, that: 1. Whitespace between blocks is like text, in that it's treated as an anonymous inline element (even if the DOM doesn't permit non-whitespace text in this location, e.g. between a <ul> and a <li>). 2. That whitespace between blocks is usually (unless "white-space" has a non-default value) then condensed to a single space. 3. The browser begins to render the single space, by laying it out as a line on its own (between the two blocks) 4. The space is removed during the line layout (because it's at the beginning of the line) 5. The line now contains nothing, so the line layout is aborted and/or the line is given zero height? 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? I used to think that whitespace was also removed by the parser before it reaches the DOM, e.g. as described in item 9 of the [XHTML Family User Agent Conformance][1] specification but apparently I was wrong, and it is not removed by the parsing from the DOM: [Why is xml:space set to 'preserve' on all elements of XHTML?][2] for XHTML2 explains that 'all elements are set to xml:space="preserve" in XHTML2, otherwise the CSS 'whitespace' property would have no effect'. >> * Is there a rule (and if so, where is this rule defined) about >> removing whitespace within inline elements? For example in the >> following sequence `<p>The <strong> lazy </strong> dog.</p>` should >> the whitespace after the `<strong>` tag be removed? (The HTML 4 spec >> has [a rule about this for line breaks][6]; I was wondering whether >> this rule also applied to other, non-line-beak whitespace, and whether >> this rule is mentioned/defined/allowed/assumed in any XHTML or CSS >> specification.) > > 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>` 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). 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 "? 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? Thanks, Christopher --- Christopher Wells http://www.modeltext.com/html/ [1]: http://www.w3.org/TR/2000/WD-xhtml-modularization-20000105/conformance.html#s_conform_user_agent [2]: http://www.w3.org/MarkUp/2004/xhtml-faq#xmlspace ______________________________________________________________________ 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/
