MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla
您的搜索结果

    Attr

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

    This type represents a DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types.

    Warning: In DOM Core 1, 2 and 3, Attr inherited from Node. This is no longer the case in DOM4. In order to bring the implementation of Attr up to specification, work is underway to change it to no longer inherit from Node. You should not be using any Node properties or methods on Attr objects. Starting in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), the ones that are going to be removed output warning messages to the console. You should revise your code accordingly. See Deprecated properties and methods for a complete list.

    Properties

    isId
    Indicates whether the attribute is an "ID attribute". An "ID attribute" being an attribute which value is expected to be unique across a DOM Document. In HTML DOM, "id" is the only ID attribute, but XML documents could define others. Whether or not an attribute is unique is often determined by a DTD or other schema description.
    name
    The attribute's name.
    ownerElement 已废弃 Gecko 7.0 已废弃 Gecko 29.0
    This property has been removed from Firefox 29. Since you can only get Attr objects from elements, you should already know the owner.
    schemaTypeInfo
    ?
    specified
    This property always returns true. Originally, it returned true if the attribute was explicitly specified in the source code or by a script, and false if its value came from the default one defined in the document's DTD.
    value
    The attribute's value.

    Deprecated properties and methods

    The following properties have been deprecated. Where available, the appropriate replacement is provided.

    attributes
    This property now always returns NULL.
    childNodes
    This property now always returns NULL.
    firstChild
    This property now always returns NULL.
    lastChild
    This property now always returns NULL.
    nextSibling
    This property now always returns NULL.
    nodeName
    Use Attr.name instead.
    nodeType
    This property now always returns 2 (ATTRIBUTE_NODE).
    nodeValue
    Use Attr.value instead.
    ownerDocument
    You shouldn't have been using this in the first place, so you probably don't care that this is going away.
    ownerElement
    Since you get an Attr object from an Element, you should already know the associated element.
    parentNode
    This property now always returns NULL.
    previousSibling
    This property now always returns NULL.
    specified
    This property now always returns true.
    textContent
    Use Attr.value instead.

    The following methods have been deprecated:

    appendChild()
    Modify the value of Attr.value instead.
    cloneNode()
    You shouldn't have been using this in the first place, so you probably don't care that this is going away.
    createAttribute()
    Use Element.setAttribute() instead.
    createAttributeNS()
    Use Element.setAttributeNS() instead.
    getAttributeNode()
    Use Element.getAttribute() instead.
    getAttributeNodeNS()
    Use Element.getAttributeNS() instead.
    hasAttributes() 已废弃 Gecko 21.0
    This method now always returns false.
    hasChildNodes()
    This method now always returns false.
    insertBefore()
    Modify the value of Attr.value instead.
    isSupported()
    You shouldn't have been using this in the first place, so you probably don't care that this is going away.
    isEqualNode()
    You shouldn't have been using this in the first place, so you probably don't care that this is going away.
    normalize()
    You shouldn't have been using this in the first place, so you probably don't care that this is going away.
    removeAttributeNode()
    Use Element.removeAttribute() instead.
    removeChild()
    Modify the value of Attr.value instead.
    replaceChild()
    Modify the value of Attr.value instead.
    setAttributeNode()
    Use Element.setAttribute() instead.
    setAttributeNodeNS()
    Use Element.setAttributeNS() instead.

    Specifications

    文档标签和贡献者

    此页面的贡献者有: AlexChao
    最后编辑者: AlexChao,