xml:space (HTML attribute)
| Depr. | Version |
|---|---|
| No | XHTML 1.0 |
Syntax
Description
If the
xml:space attribute with the value
"preserve" is applied to the script
element, the user agent (that is, 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 the XHTML modularization
guidelines (to provide a much simplified summary, duplicate or unnecessary
white spaces are removed). Currently, in XHTML 1.0, the value is fixed as
"preserve", so there’s no way not to preserve
whitespace in XHTML.
Example
This script
element’s whitespace set to "preserve" in XHTML
1.0:
<script type="text/javascript" src="/scripts/complex.js"
xml:space="preserve"></script>
Value
The only value the
xml:space attribute accepts is
"preserve".