Skip to content

Commit bee0ef7

Browse files
end closet
1 parent 2a4ca9e commit bee0ef7

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

  • 2-ui/1-document/04-searching-elements-dom

2-ui/1-document/04-searching-elements-dom/article.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,21 @@ For instance:
147147

148148
## closest
149149

150-
*Ancestors* of an element are: parent, the parent of parent, its parent and so on. The ancestors together form the chain of parents from the element to the top.
150+
*والدهای* یک element عبارت‌اند از: پدر، پدر پدر، پدر آن و ... . این والدها با یکدیگر زنجیره‌ای از والدها را از یک عنصر به سمت بالا تشکیل می‌دهند.
151151

152-
The method `elem.closest(css)` looks for the nearest ancestor that matches the CSS-selector. The `elem` itself is also included in the search.
152+
متد `elem.closest(css)` به دنبال نزدیک‌ترین والدی است که با CSS-selector تطابق دارد. خود `elem` هم شامل این جستجو می‌شود.
153153

154-
In other words, the method `closest` goes up from the element and checks each of parents. If it matches the selector, then the search stops, and the ancestor is returned.
154+
به عبارت دیگر متد `closest` از element به سمت بالا می‌رود و هر یک از والدها را چک می‌کند. اگر با selector مطابقت داشته باشد، جستجو متوقف می‌شود و آن والد برگردانده می‌شود.
155155

156-
For instance:
156+
برای مثال:
157157

158158
```html run
159159
<h1>Contents</h1>
160160

161161
<div class="contents">
162162
<ul class="book">
163-
<li class="chapter">Chapter 1</li>
164-
<li class="chapter">Chapter 2</li>
163+
<li class="chapter">بخش 1</li>
164+
<li class="chapter">بخش 2</li>
165165
</ul>
166166
</div>
167167

@@ -171,7 +171,7 @@ For instance:
171171
alert(chapter.closest('.book')); // UL
172172
alert(chapter.closest('.contents')); // DIV
173173
174-
alert(chapter.closest('h1')); // null (because h1 is not an ancestor)
174+
alert(chapter.closest('h1')); // null (یک والد نیست h1 چون)
175175
</script>
176176
```
177177

0 commit comments

Comments
 (0)