Skip to: content, navigation

by Ian Lloyd

xml:space (HTML attribute)

Spec
Depr. Version
No XHTML 1.0
xml:space="preserve"

Example

The script white spaces set to "preserve" in XHTML 1.0:

<script type="text/javascript" src="/scripts/complex.js"
 xml:space="preserve"></script>

Description

If the xml:space attribute is applied with the value "preserve" to the script element, the user agent (aka the browser) must leave all whitespace characters intact (with the exception of leading and trailing whitespace characters, which should be removed). Otherwise, whitespace will be collapsed according to the rules defined in XHTML modularization (a much simplified summary: duplicate or unnecessary white spaces are removed).

Value

"preserve" only (to not preserve whitespace, simply omit attribute)

Compatibility

User-contributed notes

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters