我发现我写的一些代码中的错误源是因为window
对象上的本地属性Entity
(显然可以通过window.Entity
访问)。我已经解决了这个问题,没有把我的东西称为“实体”,但我想知道这个属性到底是什么?
答案 0 :(得分:1)
我相信它只是Entities的构造函数,可以像window.Element一样使用它。看起来用户无法定义新的实体或元素,只能在呈现页面时定义浏览器本身。
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-527DCFF2
window.Entity.prototype.__proto__
包含以下内容:
ATTRIBUTE_NODE: 2
CDATA_SECTION_NODE: 4
COMMENT_NODE: 8
DOCUMENT_FRAGMENT_NODE: 11
DOCUMENT_NODE: 9
DOCUMENT_POSITION_CONTAINED_BY: 16
DOCUMENT_POSITION_CONTAINS: 8
DOCUMENT_POSITION_DISCONNECTED: 1
DOCUMENT_POSITION_FOLLOWING: 4
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32
DOCUMENT_POSITION_PRECEDING: 2
DOCUMENT_TYPE_NODE: 10
ELEMENT_NODE: 1
ENTITY_NODE: 6
ENTITY_REFERENCE_NODE: 5
NOTATION_NODE: 12
PROCESSING_INSTRUCTION_NODE: 7
TEXT_NODE: 3
addEventListener: function addEventListener() { [native code] }
appendChild: function appendChild() { [native code] }
cloneNode: function cloneNode() { [native code] }
compareDocumentPosition: function compareDocumentPosition() { [native code] }
constructor: function Node() { [native code] }
dispatchEvent: function dispatchEvent() { [native code] }
hasAttributes: function hasAttributes() { [native code] }
hasChildNodes: function hasChildNodes() { [native code] }
insertBefore: function insertBefore() { [native code] }
isDefaultNamespace: function isDefaultNamespace() { [native code] }
isEqualNode: function isEqualNode() { [native code] }
isSameNode: function isSameNode() { [native code] }
isSupported: function isSupported() { [native code] }
lookupNamespaceURI: function lookupNamespaceURI() { [native code] }
lookupPrefix: function lookupPrefix() { [native code] }
normalize: function normalize() { [native code] }
removeChild: function removeChild() { [native code] }
removeEventListener: function removeEventListener() { [native code] }
replaceChild: function replaceChild() { [native code] }
__proto__: Object
至于有哪些类型的实体,只需查看HTML DTD,您就会看到定义了一堆实体:http://www.w3.org/TR/html4/sgml/dtd.html
有关实体的背景信息: