代码之家  ›  专栏  ›  技术社区  ›  nickf

什么是窗口实体?

  •  1
  • nickf  · 技术社区  · 14 年前

    我发现我编写的某些代码中的错误源于 window 对象调用 Entity (显然可以通过 window.Entity ). 从那以后,我一直在解决这个问题,不把我的东西叫做“实体”,但我想知道那到底是什么东西?

    1 回复  |  直到 14 年前
        1
  •  1
  •   meder omuraliev    14 年前

    我相信它只是实体的构造函数,可以像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

    实体背景信息: