您的位置:首页 > Web前端 > JavaScript

javascript - dom2 和 dom3

2017-07-25 14:53 274 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: