五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

document.createDocumentFragment使用。

2023-02-10 12:47 作者:Tuple_元組  | 我要投稿

1.createDocumentFragment()方法,是用來(lái)創(chuàng)建一個(gè)虛擬的節(jié)點(diǎn)對(duì)象,或者說(shuō),是用來(lái)創(chuàng)建文檔碎片節(jié)點(diǎn)。它可以包含各種類型的節(jié)點(diǎn),在創(chuàng)建之初是空的。??

2.DocumentFragment節(jié)點(diǎn)不屬于文檔樹(shù),繼承的parentNode屬性總是null。它有一個(gè)很實(shí)用的特點(diǎn),當(dāng)請(qǐng)求把一個(gè)DocumentFragment節(jié)點(diǎn)插入文檔樹(shù)時(shí),插入的不是DocumentFragment自身,而是它的所有子孫節(jié)點(diǎn),即插入的是括號(hào)里的節(jié)點(diǎn)。這個(gè)特性使得DocumentFragment成了占位符,暫時(shí)存放那些一次插入文檔的節(jié)點(diǎn)。它還有利于實(shí)現(xiàn)文檔的剪切、復(fù)制和粘貼操作。

3.當(dāng)需要添加多個(gè)dom元素時(shí),如果先將這些元素添加到DocumentFragment中,再統(tǒng)一將DocumentFragment添加到頁(yè)面,會(huì)減少頁(yè)面渲染dom的次數(shù),效率會(huì)明顯提升。

4.使用appendChid方法將原dom樹(shù)中的節(jié)點(diǎn)添加到DocumentFragment中時(shí),會(huì)刪除原來(lái)的節(jié)點(diǎn)。

>DocumentFragments are DOM Node objects which are never part of the main DOM tree. The usual use case is to create the document fragment, append elements to the document fragment and then append the document fragment to the DOM tree. In the DOM tree, the document fragment is replaced by all its children.??

>Since the document fragment is in memory and not part of the main DOM tree, appending?children to it does not cause page reflow (computation of element's position and geometry). Historically, using document fragments could result in better performance.??


document.createDocumentFragment使用。的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
揭阳市| 龙陵县| 佛学| 永昌县| 朝阳区| 萨迦县| 吴桥县| 冀州市| 江山市| 沙湾县| 东方市| 大石桥市| 麻阳| 平邑县| 清原| 南充市| 安陆市| 晋江市| 嘉定区| 彰武县| 丹江口市| 衡水市| 忻州市| 上思县| 泸西县| 沧州市| 嘉义县| 常熟市| 晋中市| 金坛市| 乌兰浩特市| 武城县| 名山县| 绥阳县| 马龙县| 盈江县| 横峰县| 类乌齐县| 日喀则市| 安义县| 获嘉县|