当前位置:网站首页>When using DocumentFragments add a large number of elements
When using DocumentFragments add a large number of elements
2022-08-01 23:07:00 【Ziwei front end】
`appendChild` method to Add new element:const li = document.createElement('li');li.innerHTML = 'List item';// Append to given listul.appendChild(li);for (let i = 0; i < 100; i++) {const li = document.createElement('li');li.innerHTML = `List item ${i}`;ul.appendChild(li);}`DocumentFragment` in this case.We create a minimal document with no parent and attach our element to it.It doesn't trigger any reflow or repaint because the document fragment hasn't been added to the page yet:const fragment = document.createDocumentFragment();for (let i = 0; i < 100; i++) {const li = document.createElement('li');li.innerHTML = `List item ${i}`;fragment.appendChild(li);}ul.appendChild(fragment);边栏推荐
- CF1705D Mark and Lightbulbs
- Chapter 12 End-User Task As Shell Scripts
- JS 数组去重(含简单数组去重、对象数组去重)
- Additional Features for Scripting
- 论文解读(GSAT)《Interpretable and Generalizable Graph Learning via Stochastic Attention Mechanism》
- 用virtualenv和Virtualenvwrapper虚拟环境管理工具创建虚拟环境
- img 响应式图片的实现(含srcset属性、sizes属性的使用方法,设备像素比详解)
- 还在纠结报表工具的选型么?来看看这个
- PHP算法之电话号码的字母组合
- IDEA入门看这一篇就够了
猜你喜欢

03、GO语言变量定义、函数

Codeforces CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) A-D 题解

C#大型互联网平台管理框架源码:基于ASP.NET MVC+EF6+Bootstrap开发,支持多数据库

y84.第四章 Prometheus大厂监控体系及实战 -- prometheus告警机制进阶(十五)

10年稳定性保障经验总结,故障复盘要回答哪三大关键问题?|TakinTalks大咖分享
SQL29 Calculate the average next day retention rate of users

还在纠结报表工具的选型么?来看看这个

分享10套开源免费的高品质源码,免费源码下载平台

联邦学习在金融领域的发展和应用

华为无线设备配置双链路冷备份(AP指定配置方式)
随机推荐
excel change cell size
A. Doremy‘s IQ-- Codeforces Round #808 (Div. 1)
2022年最新河北建筑八大员(机械员)模拟考试题库及答案
2022/7/31
RxJs SwitchMapTo 操作符之移花接木
JS prototype hasOwnProperty in 加方法 原型终点 继承 重写父类方法
如何给 UE4 场景添加游戏角色
计算两点之间的距离
用virtualenv和Virtualenvwrapper虚拟环境管理工具创建虚拟环境
13、学习MySQL 分组
PAM Palindromic Automata
npm包【详解】(内含npm包的开发、发布、安装、更新、搜索、卸载、查看、版本号更新规则、package.json详解等)
Quarantine and downgrade
C#大型互联网平台管理框架源码:基于ASP.NET MVC+EF6+Bootstrap开发,支持多数据库
vscode hide menu bar
D - Linear Probing- 并查集
excel remove all carriage return from a cell
计算两点之间的中点
excel edit a cell without double clicking
ping no reply