W3C home > Mailing lists > Public > www-style@w3.org > October 2010

white-space-collapse:discard - doesn't work for me

From: Jon Ferraiolo <jferrai@us.ibm.com>
Date: Fri, 29 Oct 2010 17:44:39 -0700
To: www-style@w3.org
Message-ID: <OFD95828DD.FDBFE3A9-ON882577CC.0002E684-882577CC.00041685@us.ibm.com>


The white-space-collapse:discard algorithm says that all consecutive white
space characters get converted into a zero width non-joiner (U+200C)
character. When I tried to emulate this behavior in Firefox and Chrome, I
do not get the results I expected.

Here is my HTML and CSS:
---
<body style="white-space-collapse:discard">
  <div>
    <span>abc</span>
    <span>def</span>
  </div>
<body>
---

When I emulated the white-space-collapse algorithm using JavaScript, the
document tree turned into:
---
<body>&#x200c;<div>&#x200c;<span>abc</span>&#x200c;<span>def</span>&#x200c;</div>&#x200c;</body>
---

Since I said "discard", what I was hoping to see on my screen was:
---
abcdef
---

but instead I'm seeing an extra line break before and after "abcdef":
---
(empty line)
abcdef
(empty line)
---

Is this the expected result from the white-space-collapse:discard
algorithm? If so, then maybe there need to be another option on
white-space-collapse, something like a
"discard-everything-I-really-mean-it". :-)

Note that normal browser rendering (without white-space-collapse
processing) would not include the extra lines:
---
abc def
---

Thanks.
Jon Ferraiolo,
IBM Distinguished Engineer
Director OpenAjax Alliance
Received on Saturday, 30 October 2010 00:45:23 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:33 GMT