Update article.md
This commit is contained in:
parent
3caa91137e
commit
c7df8e3f9a
1 changed files with 5 additions and 5 deletions
|
@ -63,18 +63,18 @@ observer.observe(elem, {
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
If we change the text inside `<b>me</b>`, we'll get a single mutation:
|
If we change the text inside `<b>edit</b>`, we'll get a single mutation:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
mutationRecords = [{
|
mutationRecords = [{
|
||||||
type: "characterData",
|
type: "characterData",
|
||||||
oldValue: "me",
|
oldValue: "edit",
|
||||||
target: <text node>,
|
target: <text node>,
|
||||||
// other properties empty
|
// other properties empty
|
||||||
}];
|
}];
|
||||||
```
|
```
|
||||||
|
|
||||||
If we select and remove the `<b>me</b>` altogether, we'll get multiple mutations:
|
If we select and remove the `<b>edit</b>` altogether, we'll get multiple mutations:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
mutationRecords = [{
|
mutationRecords = [{
|
||||||
|
@ -88,8 +88,8 @@ mutationRecords = [{
|
||||||
type: "characterData"
|
type: "characterData"
|
||||||
target: <text node>
|
target: <text node>
|
||||||
// ...details depend on how the browser handles the change
|
// ...details depend on how the browser handles the change
|
||||||
// it may coalesce two adjacent text nodes "Edit " and ", please" into one node
|
// it may coalesce two adjacent text nodes "edit " and ", please" into one node
|
||||||
// or it can just delete the extra space after "Edit".
|
// or it can just delete the extra space after "edit".
|
||||||
// may be one mutation or a few
|
// may be one mutation or a few
|
||||||
}];
|
}];
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue