I was wondering what does the xml:space attribute do and what are it's values in XHTML5. an开发者_开发百科d does the xml:space attribute have any restrictions?
There is no such a thing as XHTML5. If by "XHTML5", you mean HTML5, than:
The XML specification also allows the use of the xml:space attribute in the XML namespace on any element in an XML document. This attribute has no effect on HTML elements, as the default behavior in HTML is to preserve whitespace.
From http://www.w3.org/TR/html5/elements.html
Now, for XML documents in general, xml:space specifies the way the spaces are handled. Two possible values are default
and preserve
. Default will trim all spaces to a single space (except in CDATA). Preserve will keep the number of consecutive spaces as is.
In HTML, spaces are always preserved. It allows for example to use <pre/>
tag, or white-space
property in CSS.
精彩评论