javascript

来源:互联网 发布:高干子弟的生活知乎 编辑:程序博客网 时间:2024/06/06 20:54

dom2级和3级的目的在于扩展domapi, 满足操作xml的需求, 同时提供更好的错误处理及特性检测能力

  • dom的变化:
    • node类型的变化:
      • dom2级的变化:
        • localName: 不带命名空间前缀的节点名称
        • namespaceURI: 命名空间uri或者在未指定的情况下是null
        • prefix: 命名空间前缀或者在未指定的情况下是null
      • dom3级的变化:
        • isDefaultNamespace(namespaceURI): 在指定的namespaceuri是当前节点的默认命名空间的情况下返回true
        • lookupNamespaceURI(prefix): 返回给定的prefix的命名空间
        • lookupPrefix(namespaceURI): 返回给定的namespaceURI的前缀
    • document的变化:
      • createElementNS(namespaceURI, tagName): 使用给定的tagname创建一个属于命名空间的新元素
      • createAttributeNS(namespaceURI, attribute)
      • getElementsByTagNameNS(namespaceURI, tagname): 返回指定tagename下的命名空间的nodelist
    • element的变化:
      • getAttributeNS(namespaceURI, localname_):
      • getAttributeNodeNS()
      • hasAttributeNS();
      • removeAttributeNS();
      • -
    • NodeNameMap的变化:
//dom的变化<html xmlns="http://www.w3.org/1999/xhtml">    <head>        <title>example xhtml page</title>    </head>    <body>    <s:svg xmlns:s="http://www.w3.org/1999/html"></s:svg>    </body></html>//对于html元素来说: loaclname:html, namespaceUrI: http://www.w3.org/1999/xhtml, prefix: null//对于s:svg元素来说: localname: svg, namespaceUrI: http://www.w3.org/1999/xhtml, prefix: s
原创粉丝点击