diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/cdatasection | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/cdatasection')
| -rw-r--r-- | files/zh-cn/web/api/cdatasection/index.html | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/cdatasection/index.html b/files/zh-cn/web/api/cdatasection/index.html new file mode 100644 index 0000000000..83040b1f88 --- /dev/null +++ b/files/zh-cn/web/api/cdatasection/index.html @@ -0,0 +1,85 @@ +--- +title: CDATASection +slug: Web/API/CDATASection +tags: + - API + - DOM + - 参考 + - 接口 +translation_of: Web/API/CDATASection +--- +<div>{{APIRef("DOM")}}</div> + +<p><code><strong>CDATASection</strong></code> 接口用于表示 CDATA 片段(CDATA section)。在 XML 中, CDATA 可以直接包含未经转义的文本。比如 <code><</code> 和 <code>&</code>,只要位于 CDATA 片段中,它们就不需要被转义,保持原样就可以了。</p> + +<p>在 XML 中,一个 CDATA 片段格式如下:</p> + +<pre class="syntaxbox"><![CDATA[ ... ]]> +</pre> + +<p>例如:</p> + +<pre class="brush:xml"><foo>这是一个CDATA section: <![CDATA[ < > & ]]> 其中包含了一些没有转义的字符。 </foo> +</pre> + +<p>唯一的例外就是,在一个 CDATA 片段中不可以使用 CDATA 片段本身的闭合标签片段:</p> + +<pre class="brush:xml"><![CDATA[ ]]> 会引发错误 ]]> +</pre> + +<p>注意,CDATA 片段不应该在 HTML 中被使用;它只在 XML 中有效。</p> + +<p>{{InheritanceDiagram(600, 120)}}</p> + +<h2 id="属性">属性</h2> + +<p>这个接口没有特有的属性,但实现了父接口<em> {{domxref("Text")}}</em> 的属性。</p> + +<h2 id="方法">方法</h2> + +<p>这个接口没有特有的方法,但实现了父接口<em> {{domxref("Text")}}</em> 的方法。</p> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName("DOM WHATWG", "#interface-cdatasection", "CDATASection")}}</td> + <td>{{Spec2("DOM WHATWG")}}</td> + <td>Re-added in <a href="https://github.com/whatwg/dom/pull/295">issue #295</a> due to web breakage</td> + </tr> + <tr> + <td>{{SpecName("DOM4", "#cdatasection", "CDATASection")}}</td> + <td>{{Spec2("DOM4")}}</td> + <td>Removed in favour of the more generic {{DOMxRef("Text")}} interface</td> + </tr> + <tr> + <td>{{SpecName("DOM3 Core", "core.html#ID-667469212", "CDATASection")}}</td> + <td>{{Spec2("DOM3 Core")}}</td> + <td>No change from {{SpecName("DOM2 Core")}}</td> + </tr> + <tr> + <td>{{SpecName("DOM2 Core", "core.html#ID-667469212", "CDATASection")}}</td> + <td>{{Spec2("DOM2 Core")}}</td> + <td>No change from {{SpecName("DOM1")}}.</td> + </tr> + <tr> + <td>{{SpecName("DOM1", "level-one-core.html#ID-667469212", "CDATASection")}}</td> + <td>{{Spec2("DOM1")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.CDATASection")}}</p> |
