当前位置:网站首页>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);边栏推荐
- 【参营经历贴】2022网安夏令营
- IDEA常用插件
- Postman batch test interface detailed tutorial
- 13、学习MySQL 分组
- C#大型互联网平台管理框架源码:基于ASP.NET MVC+EF6+Bootstrap开发,支持多数据库
- img 响应式图片的实现(含srcset属性、sizes属性的使用方法,设备像素比详解)
- 深度学习Course2第一周Practical aspects of Deep Learning习题整理
- 文件查询匹配神器 【glob.js】 实用教程
- APP special test: traffic test
- 小程序毕设作品之微信体育馆预约小程序毕业设计成品(3)后台功能
猜你喜欢

力扣第 304 场周赛复盘

PHP算法之电话号码的字母组合

下载安装 vscode(含汉化、插件的推荐和安装)

img 响应式图片的实现(含srcset属性、sizes属性的使用方法,设备像素比详解)

Deep Learning Course2 Week 2 Optimization Algorithms Exercises

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

数据增强--学习笔记(图像类,cnn)

简单3D渲染器的制作

小程序毕设作品之微信体育馆预约小程序毕业设计成品(3)后台功能

Wechat Gymnasium Reservation Mini Program Graduation Design Finished Work Mini Program Graduation Design Finished Product (2) Mini Program Function
随机推荐
npm包【详解】(内含npm包的开发、发布、安装、更新、搜索、卸载、查看、版本号更新规则、package.json详解等)
小程序毕设作品之微信体育馆预约小程序毕业设计成品(2)小程序功能
[机缘参悟-58]:《素书》-5-奉行仁义[遵义章第五]
PAM 回文自动机
别看了,这就是你的题呀
隔离和降级
小程序毕设作品之微信美食菜谱小程序毕业设计成品(8)毕业设计论文模板
leetcode刷题
将vim与系统剪贴板的交互使用
Quarantine and downgrade
程序员如何优雅地解决线上问题?
最短路模板
基于JAX的激活函数、softmax函数和交叉熵函数
How to use pywinauto and pyautogui to link the anime lady and sister please go home
RxJs SwitchMapTo 操作符之移花接木
10年稳定性保障经验总结,故障复盘要回答哪三大关键问题?|TakinTalks大咖分享
关于ETL的两种架构(ETL架构和ELT架构)
excel edit a cell without double clicking
excel remove all carriage return from a cell
数据增强--学习笔记(图像类,cnn)