What is window.Entity?
I discovered that the source of a bug in some code I was writing was because of a native property on the window
objec开发者_开发知识库t called Entity
(obviously accessible via window.Entity
). I've since worked around the problem by not calling my thing "Entity", but I was wondering what the hell is that property?
I believe it's just the constructor for Entities, which can be used in the same manner as window.Element. It seems like the user can't define new entities or elements, only the browser itself when it renders the page.
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-527DCFF2
window.Entity.prototype.__proto__
contains these:
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
And as to what types of entities there are, just look at the HTML DTD and you'll see a bunch of entities defined: http://www.w3.org/TR/html4/sgml/dtd.html
Background info on entities:
- http://www.javacommerce.com/displaypage.jsp?name=entities.sql&id=18238
- http://www.xml.com/pub/a/98/08/xmlqna0.html
精彩评论