Skip to content

Commit 04633a9

Browse files
authored
Update article.md
1 parent 946cde6 commit 04633a9

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

2-ui/99-ui-misc/01-mutation-observer/article.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,13 @@ let demoElem = document.getElementById('highlight-demo');
207207
observer.observe(demoElem, {childList: true, subtree: true});
208208
```
209209

210-
Here, below, there's an HTML-element and JavaScript that dynamically fills it using `innerHTML`.
210+
در اینجا، در زیر، یک عنصر HTML و جاوااسکریپت وجود دارد که به صورت پویا با استفاده از `innerHTML` آن را پر می کند.
211211

212-
Please run the previous code (above, observes that element), and then the code below. You'll see how `MutationObserver` detects and highlights the snippet.
212+
لطفا کد قبلی را اجرا کنید (در بالا، آن عنصر را مشاهده کنید)، و سپس کد زیر را اجرا کنید. خواهید دید که چگونه `MutationObserver` قطعه را شناسایی و برجسته می کند.
213213

214-
<p id="highlight-demo" style="border: 1px solid #ddd">A demo-element with <code>id="highlight-demo"</code>, run the code above to observe it.</p>
214+
<p id="highlight-demo" style="border: 1px solid #ddd">یک عنصر آزمایشی با <code>id="highlight-demo"</code>، کد بالا را اجرا کنید تا آن را مشاهده کنید.</ p>
215215

216-
The following code populates its `innerHTML`, that causes the `MutationObserver` to react and highlight its contents:
216+
کد زیر `innerHTML` خود را پر می کند، که باعث می شود`MutationObserver` واکنش نشان داده و محتوای آن را برجسته کند:
217217

218218
```js run
219219
let demoElem = document.getElementById('highlight-demo');
@@ -228,19 +228,19 @@ demoElem.innerHTML = `A code snippet is below:
228228
`;
229229
```
230230

231-
Now we have `MutationObserver` that can track all highlighting in observed elements or the whole `document`. We can add/remove code snippets in HTML without thinking about it.
231+
اکنون `MutationObserver` را داریم که می تواند تمام برجسته سازی ها در عناصر مشاهده شده یا کل `document` را ردیابی کند. ما می‌توانیم تکه‌های کد را بدون فکر کردن در HTML اضافه یا حذف کنیم.
232232

233233
## Additional methods
234234

235-
There's a method to stop observing the node:
235+
روشی برای توقف مشاهده گره وجود دارد:
236236

237-
- `observer.disconnect()` -- stops the observation.
237+
- `observer.disconnect()` - مشاهده را متوقف می کند.
238238

239-
When we stop the observing, it might be possible that some changes were not yet processed by the observer. In such cases, we use
239+
وقتی مشاهده را متوقف می کنیم، ممکن است برخی از تغییرات هنوز توسط ناظر پردازش نشده باشد. در چنین مواردی استفاده می کنیم
240240

241-
- `observer.takeRecords()` -- gets a list of unprocessed mutation records - those that happened, but the callback has not handled them.
241+
-`observer.takeRecords()` - لیستی از سوابق جهش پردازش نشده را دریافت می کند - مواردی که اتفاق افتاده اند، اما پاسخ تماس آنها را مدیریت نکرده است.
242242

243-
These methods can be used together, like this:
243+
این روش ها را می توان با هم استفاده کرد، مانند:
244244

245245
```js
246246
// get a list of unprocessed mutations
@@ -266,8 +266,8 @@ The mere fact that a DOM node is observed doesn't prevent the garbage collection
266266

267267
## Summary
268268

269-
`MutationObserver` can react to changes in DOM - attributes, text content and adding/removing elements.
269+
پس`MutationObserver` می تواند به تغییرات در DOM - ویژگی ها، محتوای متن و افزودن/حذف عناصر واکنش نشان دهد.
270270

271-
We can use it to track changes introduced by other parts of our code, as well as to integrate with third-party scripts.
271+
ما می‌توانیم از آن برای ردیابی تغییرات ایجاد شده توسط بخش‌های دیگر کدمان و همچنین برای ادغام با اسکریپت‌های شخص ثالث استفاده کنیم.
272272

273-
`MutationObserver` can track any changes. The config "what to observe" options are used for optimizations, not to spend resources on unneeded callback invocations.
273+
هم چنین `MutationObserver` می تواند هر تغییری را ردیابی کند. تنظیمات "چه چیزی را مشاهده کنیم" برای بهینه سازی استفاده می شود، نه برای صرف منابع در فراخوانی های غیر ضروری.

0 commit comments

Comments
 (0)