From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/childnode/index.html | 77 ++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 files/zh-cn/web/api/childnode/index.html (limited to 'files/zh-cn/web/api/childnode/index.html') diff --git a/files/zh-cn/web/api/childnode/index.html b/files/zh-cn/web/api/childnode/index.html new file mode 100644 index 0000000000..4566c0d514 --- /dev/null +++ b/files/zh-cn/web/api/childnode/index.html @@ -0,0 +1,77 @@ +--- +title: ChildNode +slug: Web/API/ChildNode +tags: + - API + - ChildNode + - DOM + - Node + - 接口 +translation_of: Web/API/ChildNode +--- +

{{APIRef("DOM")}}

+ +

ChildNode 混合了所有(拥有父对象) {{domxref("Node")}} 对象包含的公共方法和属性。其由 {{domxref("Element")}}、{{domxref("DocumentType")}} 和 {{domxref("CharacterData")}} 对象实现。

+ +

属性

+ +

没有继承任何属性,也没有任何专有属性。

+ +

方法

+ +

没有继承的方法。

+ +
+
{{domxref("ChildNode.remove()")}} {{experimental_inline}}
+
ChildNode 从其父节点的子节点列表中移除。
+
{{domxref("ChildNode.before()")}} {{experimental_inline}}
+
在其父节点的子节点列表中插入一些 {{domxref("Node")}} 或 {{domxref("DOMString")}} 对象。插入位置为 ChildNode 之前。{{domxref("DOMString")}} 对象会被以 {{domxref("Text")}} 的形式插入。
+
{{domxref("ChildNode.after()")}} {{experimental_inline}}
+
在其父节点的子节点列表中插入一些{{domxref("Node")}} 或 {{domxref("DOMString")}} 对象。插入位置为 ChildNode 之后。{{domxref("DOMString")}} 对象会被以 {{domxref("Text")}} 的形式插入。
+
{{domxref("ChildNode.replaceWith()")}} {{experimental_inline}}
+
使用一组 {{domxref("Node")}} 或 {{domxref("DOMString")}} 对象替换 ChildNode。{{domxref("DOMString")}} 对象会以 {{domxref("Text")}} 的形式插入。
+
+ +

规范

+ + + + + + + + + + + + + + + + + + + +
规范状态说明
{{SpecName('DOM WHATWG', '#interface-childnode', 'ChildNode')}}{{Spec2('DOM WHATWG')}}Splitted the ElementTraversal interface in {{domxref("ParentNode")}} and ChildNode. The previousElementSibling and nextElementSibling are now defined on the latter. The {{domxref("CharacterData")}} and {{domxref("DocumentType")}} implemented the new interfaces. 新增 remove(), before(), after() and replace() 这四个方法。
{{SpecName('Element Traversal', '#interface-elementTraversal', 'ElementTraversal')}}{{Spec2('Element Traversal')}}Added the initial definition of its properties to the ElementTraversal pure interface and use it on {{domxref("Element")}}.
+ +

Polyfill

+ +

GitHub 上的外部资源:childNode.js

+ +

浏览器兼容性

+ + + +

{{Compat("api.ChildNode")}}

+ +

参见

+ + -- cgit v1.2.3-54-g00ecf