Update article.md

This commit is contained in:
LeviDing 2020-04-04 16:40:05 +08:00 committed by GitHub
parent 09404a069e
commit b82443d6b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -194,9 +194,9 @@ Others:
To manipulate the content within the range: To manipulate the content within the range:
- `deleteContents()` - remove range content from the document - `deleteContents()` -- remove range content from the document
- `extractContents()` - remove range content from the document and return as [DocumentFragment](info:modifying-document#document-fragment) - `extractContents()` -- remove range content from the document and return as [DocumentFragment](info:modifying-document#document-fragment)
- `cloneContents()` - clone range content and return as [DocumentFragment](info:modifying-document#document-fragment) - `cloneContents()` -- clone range content and return as [DocumentFragment](info:modifying-document#document-fragment)
- `insertNode(node)` -- insert `node` into the document at the beginning of the range - `insertNode(node)` -- insert `node` into the document at the beginning of the range
- `surroundContents(node)` -- wrap `node` around range content. For this to work, the range must contain both opening and closing tags for all elements inside it: no partial ranges like `<i>abc`. - `surroundContents(node)` -- wrap `node` around range content. For this to work, the range must contain both opening and closing tags for all elements inside it: no partial ranges like `<i>abc`.
@ -318,8 +318,7 @@ There are events on to keep track of selection:
### Selection tracking demo ### Selection tracking demo
Here's a small demo that shows selection boundaries Here's a small demo that shows selection boundaries dynamically as it changes:
dynamically as it changes:
```html run height=80 ```html run height=80
<p id="p">Select me: <i>italic</i> and <b>bold</b></p> <p id="p">Select me: <i>italic</i> and <b>bold</b></p>