这篇翻译不完整。请帮忙从英语翻译这篇文章

Node是一个接口,许多DOM类型从这个接口继承,并允许类似地处理(或测试)这些各种类型。

以下接口都从Node继承其方法和属性:

Document, Element, CharacterData (which Text, Comment, and CDATASection inherit), ProcessingInstruction, DocumentFragment, DocumentType, Notation, Entity, EntityReference

在方法和属性不相关的特定情况下,这些接口可能返回null。它们可能会抛出异常 - 例如,当将子节点添加到没有子节点的节点类型时。

属性

从其父类EventTarget[1]继承属性。

方法

从其父类EventTarget[1]继承方法。

常量

查看Node.nodeType

Name Value
ELEMENT_NODE 1
ATTRIBUTE_NODE 2
TEXT_NODE 3
DATA_SECTION_NODE 4
ENTITY_REFERENCE_NODE 5
ENTITY_NODE 6
PROCESSING_INSTRUCTION_NODE 7
COMMENT_NODE 8
DOCUMENT_NODE 9
DOCUMENT_TYPE_NODE 10
DOCUMENT_FRAGMENT_NODE 11
NOTATION_NODE 12
DOCUMENT_POSITION_DISCONNECTED 1
DOCUMENT_POSITION_PRECEDING 2
DOCUMENT_POSITION_FOLLOWING 4
DOCUMENT_POSITION_CONTAINS 8
DOCUMENT_POSITION_CONTAINED_BY 16
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC 32

规范

规范

Specification Status Comment
DOM
Node
Living Standard Removed the following properties: attributesnamespaceURIprefix, and localName.
Removed the following methods: isSupported()hasAttributes()getFeature()setUserData(), and getUserData().
Document Object Model (DOM) Level 3 Core Specification
Node
Recommendation The methods insertBefore()replaceChild()removeChild(), and appendChild() returns one more kind of error (NOT_SUPPORTED_ERR) if called on a Document.
The normalize() method has been modified so that Text node can also be normalized if the proper DOMConfiguration flag is set.
Added the following methods: compareDocumentPosition()isSameNode()lookupPrefix()isDefaultNamespace()lookupNamespaceURI()isEqualNode()getFeature()setUserData(), and getUserData().
Added the following properties: baseURI and textContent.
Document Object Model (DOM) Level 2 Core Specification
Node
Recommendation The ownerDocument property was slightly modified so that DocumentFragment also returns null.
Added the following properties: namespaceURIprefix, and localName.
Added the following methods: normalize()isSupported() and hasAttributes().
Document Object Model (DOM) Level 1 Specification
Node
Recommendation Initial definition

浏览器兼容性

未实现22.0 (22.0)

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes)[1] (Yes) 1.0 (1.7 or earlier) (Yes) (Yes)[1] (Yes)[1]
getFeature() 未实现 ? 1.0 (1.7 or earlier)
未实现7.0 (7.0)
? 未实现 未实现
getUserData()setUserData()and hasAttributes() 未实现 ? 1.0 (1.7 or earlier)
未实现22.0 (22.0)
? 未实现 未实现
isSameNode() (Yes) ? 1.0 (1.7 or earlier)
Removed in 10 (10)
Returned in 48 (48)
? 未实现 未实现
isSupported() 未实现 ? 1.0 (1.7 or earlier) ? ? ? ?
attributes 未实现 ? 1.0 (1.7 or earlier)
未实现22.0 (22.0)[2]
未实现 未实现 未实现
rootNode() ? ? CompatGeckoDesktop(48)}} ? ? ?
namespaceURIlocalNameprefix  (Yes)
未实现46.0[3]
? (Yes)
未实现48.0[3]
? ? ?
getRootNode 54.0 ? ? ? 41 ?
Feature Android Android Webview Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support ? (Yes)[1] (Yes) 1.0 (1.0) (Yes) (Yes)[1] (Yes)[1] (Yes)[1]
getFeature() 未实现 未实现 ? 1.0 (1.0)
未实现7.0 (7.0)
? 未实现 未实现 未实现
getUserData()setUserData()and hasAttributes() 未实现 未实现 ? ? ? ? ? 未实现
isSameNode() ? (Yes) ?

1.0 (1.7 or earlier)
Removed in 10 (10)
Returned in 48 (48)

? ? ? (Yes)
isSupported() ? 未实现 ? ? ? ? ? 未实现
attributes ? 未实现 ? ? ? ? ? 未实现
rootNode() ? 未实现 ? 48.0 (48) ? ? ? 未实现
namespaceURIlocalNameprefix  ? 未实现 ? (Yes)
未实现48.0[3]
? ? ? 未实现
getRootNode() 未实现 54.0 ? ? ? 41 ? 54.0

[1] WebKit and old versions of Blink incorrectly do not make Node inherit from EventTarget.

[2] In Gecko 22.0 (Firefox 22.0 / Thunderbird 22.0 / SeaMonkey 2.19) the attributes property was moved to Element.

[3] The properties were moved to the Element and Attr APIs according to the DOM4 standard.

文档标签和贡献者

标签: 
 此页面的贡献者: wenshin, xgqfrms-GitHub, AlexChao, Losses, ziyunfei
 最后编辑者: wenshin,