ChildNode

1 位贡献者:

ChildNode 接口包含了只对那些有父节点的节点(Node)对象有效的方法。

ChildNode 是一个原始接口(raw interface),不能创建这种类型的对象;它在 ElementDocumentTypeCharacterData 对象上被实现。

属性

There is neither inherited, nor specific property.

方法

There is no inherited method.

ChildNode.remove()
Removes this ChildNode from the children list of its parent.
ChildNode.before()
Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just before this ChildNode. DOMString objects are inserted as equivalent Text nodes.
ChildNode.after()
Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just after this ChildNode. DOMString objects are inserted as equivalent Text nodes.
ChildNode.replace()
Replace this ChildNode in the children list of its parent with a set of Node or DOMString objects. DOMString objects are inserted as equivalent Text nodes.

规范

Specification Status Comment
DOM
ChildNode
Living Standard Splitted the ElementTraversal interface in ParentNode and ChildNode. The previousElementSibling and nextElementSibling are now defined on the latter.
The CharacterData and DocumentType implemented the new interfaces.
Added the remove(), before(), after() and replace() methods.
Element Traversal Specification
ElementTraversal
Recommendation Added the initial definition of its properties to the ElementTraversal pure interface and use it on Element.

浏览器兼容性

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (on Element) 1.0 23.0 (23.0) 9.0 [1] 10.0 4.0
Support on DocumentType and CharacterData 23.0 23.0 (23.0) 未实现 16.0 未实现
remove() 29.0 23.0 (23.0) 未实现 16.0 未实现
before(), after(), and replace() 未实现 未实现 未实现 未实现 未实现
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (on Element) (Yes) 23.0 (23.0) (Yes) 10.0 (Yes)
Support on DocumentType and CharacterData (Yes) 23.0 (23.0) 未实现 16.0 未实现
remove() (Yes) 23.0 (23.0) 未实现 16.0 未实现
before(), after(), and replace() 未实现 未实现 未实现 未实现 未实现

相关链接

文档标签和贡献者

向此页面作出贡献: AlexChao
最后编辑者: AlexChao,