{{翻译}}Node.cloneNode
来源:互联网 发布:人工智能开发语言最好 编辑:程序博客网 时间:2024/05/16 13:48
{{翻译}}Node.cloneNode
返回Node结点的副本。
调用方法:
var dupNode = node.cloneNode(deep);
其中参数
node:原结点
dupNode:原结点的副本
deep:
true 原结点的子结点将会被cloned
false 只clone指定的结点
Note: In the DOM4 specification (as implemented in Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0) ), deep is an optional argument. If omitted, the method acts as if the value of deep was true, defaulting to using deep cloning as the default behavior. If you want to use shallow cloning, you need to explicitly set this argument to false.
In browsers supporting previous versions of the DOM, you always need to provide this argument.
用例:
var p = document.getElementById("para1"),
p_prime = p.cloneNode(true);
注意:
拷贝结点会拷贝所有的属性和属性值,但不会拷贝结点绑定的事件监听器。
cloneNode()返回的结点副本直到使用Node.appendChild()或其它的方法添加到文档中的某个结点时才会成为文档的一部分。在此之前该结点副本不具有父结点。
若deep置为false,则不会有子结点被拷贝。该结点中所含的任意文本都不会被拷贝。
若deep置为true,则整个子结点树都会被拷贝。
Warning: cloneNode() may lead to duplicate element IDs in a document.(cloneNode()可能导致文档中出现重复的元素id)
将由cloneNode()获得的结点副本添加到其它结点中时它会获得新的uniqueID.
The duplicate node returned by cloneNode() receives a new uniqueID when it is added to another node
若想拷贝结点添加到其它的document中,请使用Document.importNode().
To clone a node for appending to a different document, use Document.importNode() instead.
原文:https://developer.mozilla.org/en/DOM/Node.cloneNode
返回Node结点的副本。
调用方法:
var dupNode = node.cloneNode(deep);
其中参数
node:原结点
dupNode:原结点的副本
deep:
true 原结点的子结点将会被cloned
false 只clone指定的结点
Note: In the DOM4 specification (as implemented in Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0) ), deep is an optional argument. If omitted, the method acts as if the value of deep was true, defaulting to using deep cloning as the default behavior. If you want to use shallow cloning, you need to explicitly set this argument to false.
In browsers supporting previous versions of the DOM, you always need to provide this argument.
用例:
var p = document.getElementById("para1"),
p_prime = p.cloneNode(true);
注意:
拷贝结点会拷贝所有的属性和属性值,但不会拷贝结点绑定的事件监听器。
cloneNode()返回的结点副本直到使用Node.appendChild()或其它的方法添加到文档中的某个结点时才会成为文档的一部分。在此之前该结点副本不具有父结点。
若deep置为false,则不会有子结点被拷贝。该结点中所含的任意文本都不会被拷贝。
若deep置为true,则整个子结点树都会被拷贝。
Warning: cloneNode() may lead to duplicate element IDs in a document.(cloneNode()可能导致文档中出现重复的元素id)
将由cloneNode()获得的结点副本添加到其它结点中时它会获得新的uniqueID.
The duplicate node returned by cloneNode() receives a new uniqueID when it is added to another node
若想拷贝结点添加到其它的document中,请使用Document.importNode().
To clone a node for appending to a different document, use Document.importNode() instead.
原文:https://developer.mozilla.org/en/DOM/Node.cloneNode
- {{翻译}}Node.cloneNode
- 点击新增行 CloneNode
- insertBefore、cloneNode、appendChild...
- cloneNode()方法的使用
- createElement cloneNode appendChild applyElement
- cloneNode id name
- js中cloneNode
- 38. Element cloneNode() 方法
- javascript cloneNode()方法
- node C++扩展(2) 尝试翻译node官网文档
- Node.js中connect-flash文档翻译
- node crypto sha192 翻译为java
- UE4蓝图节点翻译---Add Documentation Node...
- UE4蓝图节点翻译---Add Reroute Node...
- UE4蓝图节点翻译---Add Return Node...
- js中cloneNode()的使用
- JS中的createElement(),createTextNode(),cloneNode()
- js中cloneNode()的使用
- 代码注释法学习智能指针intrusive_ptr
- Linux 实践 Oracle 10g X64
- Xcode 4.3+ NSLog中文不输出Bug及解决方法
- 短址(short URL)原理及其实现
- freopen()函数在ACM中的使用
- {{翻译}}Node.cloneNode
- Array,Arraylist,ArrayCollection使用详解
- 笔试题总结
- 字符串的“无重复”全排列递归算法
- 解决给textarea赋不了值的问题
- #define用法总结
- g++: command not found的解决
- 如何把narray的数据输出成文本格式
- ubuntu最新地址