documentFragment添加节点

 1 <!DOCTYPE html>
 2 <html>
 3     <head>
 4         <title>documentFragment添加节点</title>
 5     </head>
 6     <body>
 7         <ul></ul>
 8     </body>
 9     <script>
10         let documentFragment = document.createDocumentFragment();
11         for(let i=0;i<100;i++){
12             let ali = document.createElement('li');
13             documentFragment.appendChild(ali);
14         }
15         document.body.appendChild( documentFragment)
16     </script>
17 </html>

 

posted @ 2018-03-09 10:28  gaoxuerong  阅读(188)  评论(0编辑  收藏  举报