Update article.md

This commit is contained in:
Mehdi KHALIL EL OUADGHIRI 2019-07-18 11:31:47 +02:00 committed by GitHub
parent 3caa91137e
commit c7df8e3f9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}]; }];
``` ```