Skip to content

Commit 490817e

Browse files
Update article.md
1 parent bee0ef7 commit 490817e

1 file changed

Lines changed: 17 additions & 14 deletions

File tree

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

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

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

148148
## closest
149149

150-
*والدهای* یک element عبارت‌اند از: پدر، پدر پدر، پدر آن و ... . این والدها با یکدیگر زنجیره‌ای از والدها را از یک عنصر به سمت بالا تشکیل می‌دهند.
150+
*والدهای* یک element عبارت‌اند از: پدر، پدر پدر، پدر آن و ... . این والدها با یکدیگر زنجیره‌ای از والدها را از یک element به سمت بالا تشکیل می‌دهند.
151151

152152
متد `elem.closest(css)` به دنبال نزدیک‌ترین والدی است که با CSS-selector تطابق دارد. خود `elem` هم شامل این جستجو می‌شود.
153153

@@ -177,38 +177,41 @@ For instance:
177177

178178
## getElementsBy*
179179

180-
There are also other methods to look for nodes by a tag, class, etc.
180+
همچنین روش‌های دیگری برای جستجو برای یک node با tag، class و ... وجود دارد.
181181

182-
Today, they are mostly history, as `querySelector` is more powerful and shorter to write.
182+
امروزه آن‌ها بیشتر تاریخچه هستند چون `querySelector` قدرتمندتر است و برای نوشتن سریع‌تر است.
183183

184-
So here we cover them mainly for completeness, while you can still find them in the old scripts.
184+
پس اینجا ما بیشتر آن‌ها را برای کامل بودن پوشش می‌دهیم اما هنوز می‌توانید آن‌ها را در scriptهای قدیمی پیدا کنید.
185185

186-
- `elem.getElementsByTagName(tag)` looks for elements with the given tag and returns the collection of them. The `tag` parameter can also be a star `"*"` for "any tags".
187-
- `elem.getElementsByClassName(className)` returns elements that have the given CSS class.
188-
- `document.getElementsByName(name)` returns elements with the given `name` attribute, document-wide. Very rarely used.
186+
- عبارت `elem.getElementsByTagName(tag)` به دنبال elementهایی با tag داده شده است و مجموعه‌ی آن‌ها را برمی‌گرداند. پارامتر `tag` همچنین می‌تواند یک ستاره باشد `"*"` به معنای تمام tag ها.
189187

190-
For instance:
188+
- عبارت `elem.getElementsByClassName(className)` تمام elementهایی که کلاس CSS داده شده را دارند برمی‌گرداند.
189+
190+
- عبارت `document.getElementsByName(name)`تمام elementهایی که `name` به عنوان attribute به آن‌ها داده شده است را برمی‌گرداند و بسیار کم استفاده می‌شود.
191+
192+
برای مثال:‌
191193
```js
192-
// get all divs in the document
194+
195+
//تمام div های درون document را می‌گیرد.
193196
let divs = document.getElementsByTagName('div');
194197
```
195198

196-
Let's find all `input` tags inside the table:
199+
بیایید تمام tagهای `input` درون این table را پیدا کنیم:‌
197200

198201
```html run height=50
199202
<table id="table">
200203
<tr>
201-
<td>Your age:</td>
204+
<td>سن شما:</td>
202205

203206
<td>
204207
<label>
205-
<input type="radio" name="age" value="young" checked> less than 18
208+
<input type="radio" name="age" value="young" checked> کمتر از 18
206209
</label>
207210
<label>
208-
<input type="radio" name="age" value="mature"> from 18 to 50
211+
<input type="radio" name="age" value="mature"> از 18 تا 50
209212
</label>
210213
<label>
211-
<input type="radio" name="age" value="senior"> more than 60
214+
<input type="radio" name="age" value="senior"> بیشتر از 60
212215
</label>
213216
</td>
214217
</tr>

0 commit comments

Comments
 (0)