W3C Amaya

previous top

About White Space Handling

Amaya removes insignificant white-space characters when it loads a document unless they must be explicitly preserved. This is true for XHTML, MathML, and SVG documents, as well as MathML or SVG elements included in a HTML document,

The following are considered as insignificant white-space characters:

To preserve all the characters for some elements, use the xml:space attribute or the PRE element (only valid for XHTML documents). The possible values for the xml:space attribute are default and preserve.

You apply the xml:space attribute to all elements within the content of the element where it is specified, unless it is overriden with another instance of the xml:space attribute.

In an XHTML DTD, the PRE element causes the same behavior as the xml:space attribute with the value preserve.

Amaya applies white space handling when it loads a document, not during editing. A consequence is that if you type insignificant white-space characters, they will be visible and saved but will be removed the next time the document is loaded. For example, the following source code:

<p>Amaya removes the <strong> insignificant white-space </strong>when it loads ...</p>

displays as follows during editing:

Amaya removes the insignificant white-space when it loads...

The text will be saved with that syntax. However, the next time the document is loaded, the text will display as:

Amaya removes theinsignificant white-spacewhen it loads...

because the leading and trailing spaces of the element <strong> are considered to be insignificant and are removed.

The correct source code would be:

<p>Amaya removes the <strong>insignificant white-space</strong> when it loads ...</p>