일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- react
- innerHTML
- Temporal dead zone
- beforeinput
- dotenv
- es6
- node.js
- css:position
- UI
- Review
- a11y
- keyup
- javascript
- for loop
- js
- nodeValue
- Empty
- textContent
- HTML
- node
- yet
- Event
- ES5
- keyboardEvent
- TypingEffect
- innerText
- modal
- CSS
- addEventListener
- Dom
- Today
- Total
the murmurous sea
[HTML DOM] DocumentFragment 본문
1. a minimal document object that has no parent.
2. used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document.
3. The key difference is due to the fact that the document fragment isn't part of the active document tree structure.
4. Changes made to the fragment don't affect the document (even on reflow) or incur any performance impact when changes are made.
5. No specific Properties, Methods
: inherits properties and methods of its parent, Node, and implements those of the ParentNode interface.
6. An empty DocumentFragment can be created using the document.createDocumentFragment() method or the constructor.
[Constructor]
DocumentFragment()
[document.createDocumentFragment()]
: creates an imaginary Node object, with all the properties and methods of the Node object.
: useful when you want to extract parts of your document / change, add, or delete, some of the content and insert it back to your document. You can also use the document's Document object to perform these changes, but to prevent destroying the document structure, it can be safer to extract only parts of the document, make the changes, and insert the part back to the document.
[Common Use]
: to create one, assemble a DOM subtree within it, then append or insert the fragment into the DOM.
: moves the fragment's nodes into the DOM, leaving behind an empty DocumentFragment. Because all of the nodes are inserted into the document at once, only one reflow and render is triggered instead of potentially one for each node inserted if they were inserted separately.
https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment
https://www.w3schools.com/jsref/met_document_createdocumentfragment.asp
'#dev > 개념정리' 카테고리의 다른 글
JS, ES1: split() (0) | 2020.05.04 |
---|---|
JS: padStart() & padEnd() (0) | 2020.05.04 |
HTML DOM: insertBefore() (0) | 2020.05.02 |
선언적 함수 vs 함수표현식 vs 익명함수 (waiting list) (0) | 2020.05.02 |
JS DOM: how to insert a new node AFTER an existing node (0) | 2020.05.01 |