createDocumentFragment 详解
生活随笔
收集整理的這篇文章主要介紹了
createDocumentFragment 详解
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
DocumentFragment 是一個無父對象的document對象. 他支持以下DOM2方法: appendChild, cloneNode, hasAttributes, hasChildNodes, insertBefore, normalize, removeChild, replaceChild.
也支持以下DOM2屬性?attributes, childNodes, firstChild, lastChild, localName, namespaceURI, nextSibling, nodeName, nodeType, nodeValue, ownerDocument, parentNode, prefix, previousSibling, textContent.
?? 其他方法可以將document fragment 作為一個參數,(比如Node? 的 appendChild和insertBefore?方法),
這樣,fragment 就可以被追加到父對象中。
Example:
??
2frag.appendChild(document.createTextNode('Ipsum?Lorem'));
3document.body.appendChild(frag);
4
以上所有的方法是在DOM2基礎上測試通過。
總結
以上是生活随笔為你收集整理的createDocumentFragment 详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: getAttribute获取属性值
- 下一篇: 神奇的幻方(洛谷P2615题题解,Jav