Mutation observer by AdriandeCita · Pull Request #372 · javascript-tutorial/uk.javascript.info
Згадав, що у вас тут було прийнято замість апострофа використовували одинарну праву лапку. Це досі актуально, чи мій "стандартний" апостроф теж згодиться?
@AdriandeCita дякую за переклад, стандартний апостроф підійде :) Дивлюся :)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Дякую за чудовий переклад!
Подивіться, будь ласка, мої коментарі, напишіть мені, якщо не згодні з чимось :)
| # Mutation Observer (спостерігач за мутаціями) | ||
|
|
||
| `MutationObserver` is a built-in object that observes a DOM element and fires a callback when it detects a change. | ||
| `MutationObserver` -- це вбудований об'єкт, який спостерігає за елементом DOM і викликає функцію зворотного виклику кожного разу, коли він помічає зміну. |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `MutationObserver` -- це вбудований об'єкт, який спостерігає за елементом DOM і викликає функцію зворотного виклику кожного разу, коли він помічає зміну. | |
| `MutationObserver` -- це вбудований об’єкт, який спостерігає за елементом DOM і викликає функцію зворотного виклику кожного разу, коли він помічає зміну. |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - `attributes` -- attributes of `node`, | ||
| - `attributeFilter` -- an array of attribute names, to observe only selected ones. | ||
| - `characterData` -- whether to observe `node.data` (text content), | ||
| `config` -- це об'єкт із булевими опціями, які вказують "на якого роду зміни слід реагувати": |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `config` -- це об'єкт із булевими опціями, які вказують "на якого роду зміни слід реагувати": | |
| `config` -- це об’єкт із булевими опціями, які вказують "на якого роду зміни слід реагувати": |
| - `characterDataOldValue` -- якщо дорівнює `true` -- до функції зворотного виклику буде передано і нове, і старе значення `node.data` (дивіться нижче), а інакше передаватиме лише нове значення (потребує вказаної опції `characterData`). | ||
|
|
||
| Then after any changes, the `callback` is executed: changes are passed in the first argument as a list of [MutationRecord](https://dom.spec.whatwg.org/#mutationrecord) objects, and the observer itself as the second argument. | ||
| Далі після будь-яких змін виконується `callback`: зміни передаються першим аргументом у вигляді списку об'єктів типу [MutationRecord](https://dom.spec.whatwg.org/#mutationrecord), а другим аргументом передається сам спостерігач. |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Далі після будь-яких змін виконується `callback`: зміни передаються першим аргументом у вигляді списку об'єктів типу [MutationRecord](https://dom.spec.whatwg.org/#mutationrecord), а другим аргументом передається сам спостерігач. | |
| Далі після будь-яких змін виконується `callback`: зміни передаються першим аргументом у вигляді списку об’єктів типу [MutationRecord](https://dom.spec.whatwg.org/#mutationrecord), а другим аргументом передається сам спостерігач. |
| Далі після будь-яких змін виконується `callback`: зміни передаються першим аргументом у вигляді списку об'єктів типу [MutationRecord](https://dom.spec.whatwg.org/#mutationrecord), а другим аргументом передається сам спостерігач. | ||
|
|
||
| [MutationRecord](https://dom.spec.whatwg.org/#mutationrecord) objects have properties: | ||
| Об'єкти [MutationRecord](https://dom.spec.whatwg.org/#mutationrecord) містять такі властивості: |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Об'єкти [MutationRecord](https://dom.spec.whatwg.org/#mutationrecord) містять такі властивості: | |
| Об’єкти [MutationRecord](https://dom.spec.whatwg.org/#mutationrecord) містять такі властивості: |
| - `target` -- де саме відбулася зміна: для `"attributes"` це елемент, або текстовий вузол у випадку `"characterData"`, або елемент для мутації типу `"childList"`, | ||
| - `addedNodes/removedNodes` -- вузли, які було додано/прибрано, | ||
| - `previousSibling/nextSibling` -- відповідно попередній та наступний елемент відносно доданих/прибраних вузлів, | ||
| - `attributeName/attributeNamespace` -- ім'я/простір імен (для XML) зміненого атрибута, |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - `attributeName/attributeNamespace` -- ім'я/простір імен (для XML) зміненого атрибута, | |
| - `attributeName/attributeNamespace` -- ім’я/простір імен (для XML) зміненого атрибута, |
| Ось робочий приклад. | ||
|
|
||
| If you run this code, it starts observing the element below and highlighting any code snippets that appear there: | ||
| Якщо ви запустите цей код, він почне спостерігати за наведеним нижче елементом, і підсвічувати будь який фрагмент коду, який з'являтиметься там: |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Якщо ви запустите цей код, він почне спостерігати за наведеним нижче елементом, і підсвічувати будь який фрагмент коду, який з'являтиметься там: | |
| Якщо ви запустите цей код, він почне спостерігати за наведеним нижче елементом, і підсвічувати будь який фрагмент коду, який з’являтиметься там: |
| // should be called before disconnecting, | ||
| // if you care about possibly unhandled recent mutations | ||
| // отримання переліку необроблених мутацій | ||
| // повинно викликатись перед роз'єднанням, |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // повинно викликатись перед роз'єднанням, | |
| // повинно викликатись перед роз’єднанням, |
Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻
Згоден, щодо апострофу. Думаю, ми спробуємо найближчим часом привести все до ладу у цьому питанні якось автоматично :) Дякую, за ваш внесок!
dolgachio
changed the title
translation: mutation observer
Mutation observer
Thank you 💖 I updated the Progress Issue #1 🎉 🎉 🎉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters