CDATASection

The CDATASection interface represents a CDATA section that can be used within XML to include extended portions of unescaped text. The symbols < and & don’t need escaping as they normally do when inside a CDATA section.

In XML, a CDATA section looks like:

<![CDATA[ ... ]]>

For example:

<foo>Here is a CDATA section: <![CDATA[ < > & ]]> with all kinds of unescaped text.</foo>

The only sequence which is not allowed within a CDATA section is the closing sequence of a CDATA section itself, ]]>:

<![CDATA[ ]]> will cause an error ]]>

Note that CDATA sections should not be used within HTML; they only work in XML.

Properties

This interface has no specific properties and implements those of its parent Text.

Methods

This interface has no specific methods and implements those of its parent Text.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
CDATASection
1
12
1
9
≤12.1
3
≤37
18
4
≤12.1
1
1.0

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CDATASection