Skip to content

Searching: getElement*, querySelector* #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Jul 31, 2023

Conversation

shahrzadJavadiKoushesh
Copy link
Contributor

No description provided.

@CLAassistant
Copy link

CLAassistant commented Jul 16, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@alivarastepour alivarastepour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please re-format your translation so that the number of lines match the number of lines in the original version. comment /done when done.

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@shahrzadJavadiKoushesh
Copy link
Contributor Author

Hi, you have forgotten to merge your changes to the current branch; also note that top file metadata should not be translated.

/done

Copy link
Contributor

@alivarastepour alivarastepour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello again,
First of all, thanks for your contribution and time devoted to this project;
As you have probably guessed, using markdown with two languages which have different directions is a bit challenging; so we kindly ask you to follow the steps mentioned in this repo to bring a local server up and see your changes as they are made to each individual markdown.
all changes should maintain the readability of document; currently, that is not the case with your changes.
Thanks again

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@mahdiHash
Copy link
Contributor

Hello again, First of all, thanks for your contribution and time devoted to this project; As you have probably guessed, using markdown with two languages which have different directions is a bit challenging; so we kindly ask you to follow the steps mentioned in this repo to bring a local server up and see your changes as they are made to each individual markdown. all changes should maintain the readability of document; currently, that is not the case with your changes. Thanks again

Checking the translation with the server repo isn't that necessary. You can read the article on github since it'll keep the RTL format of Persian (although in some cases it's overridden, but it's ok overall).
So, please submit your review on this translation, @alivarastepour.

Copy link
Contributor

@alivarastepour alivarastepour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @shahrzadJavadiKoushesh , i have proposed some changes to improve your translation even further. please review them.

```

## querySelectorAll [#querySelectorAll]

By far, the most versatile method, `elem.querySelectorAll(css)` returns all elements inside `elem` matching the given CSS selector.
تا اینجا، همه‌کاره‌ترین روش `elem.querySelectorAll(css)` بود که تمام elementهای درون `elem` که با css selector داده شده تطابق دارند را انتخاب می‌کند.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
تا اینجا، همه‌کاره‌ترین روش `elem.querySelectorAll(css)` بود که تمام elementهای درون `elem` که با css selector داده شده تطابق دارند را انتخاب می‌کند.
با اختلاف، جامع‌ترین روش جستجو، `elem.querySelectorAll(css)` است که تمام elementهای درون `elem` که با css selector داده شده تطابق دارند را انتخاب می‌کند.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
تا اینجا، همه‌کاره‌ترین روش `elem.querySelectorAll(css)` بود که تمام elementهای درون `elem` که با css selector داده شده تطابق دارند را انتخاب می‌کند.
تا اینجا، جامع‌ترین روش جستجو `elem.querySelectorAll(css)` بود که تمام elementهای درون `elem` که با css selector داده شده تطابق دارند را انتخاب می‌کند.

"By far" translation is correct.


The method comes in handy when we are iterating over elements (like in an array or something) and trying to filter out those that interest us.
این روش زمانی به کار می‌آید که می‌خواهیم روی elementهایی (مثل آرایه یا همچین چیزی) iterate کنیم و آن‌هایی که مطلوب هستند را فیلتر کنیم.

For instance:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For instance:
برای مثال:


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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
امروزه آن‌ها بیشتر تاریخچه هستند چون `querySelector` قدرتمندتر است و برای نوشتن سریع‌تر است.
امروزه آن‌ها کمتر استفاده می‌شوند چون `querySelector` قدرتمندتر است و برای نوشتن سریع‌تر است.

@@ -363,12 +365,12 @@ There are 6 main methods to search for nodes in DOM:
</tbody>
</table>

By far the most used are `querySelector` and `querySelectorAll`, but `getElement(s)By*` can be sporadically helpful or found in the old scripts.
.های قدیمی یافت شود script هم گاهی به صورت پراکنده می‌تواند مفید باشد یا در `getElement(s)By` شده است، اما `querySelectorAll` و `querySelector` تا اینجا بیشترین استفاده از
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.های قدیمی یافت شود script هم گاهی به صورت پراکنده می‌تواند مفید باشد یا در `getElement(s)By` شده است، اما `querySelectorAll` و `querySelector` تا اینجا بیشترین استفاده از
.های قدیمی یافت شود script هم گاهی به صورت پراکنده می‌تواند مفید باشد یا در `getElement(s)By` شده است، اما `querySelectorAll` و `querySelector` با اختلاف بیشترین استفاده از

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The translation is ok, but aren't the words disordered?
It's not a code comment, so if you've changed the order of translation, please turn it back.

And let's mention one more method here to check for the child-parent relationship, as it's sometimes useful:
- `elemA.contains(elemB)` returns true if `elemB` is inside `elemA` (a descendant of `elemA`) or when `elemA==elemB`.
و بیایید اینجا یک روش دیگر برای بررسی رابطه والد و فرزند را چک کنیم،‌چون بعضی وقت‌ها مفید است:
.را برمی‌گرداند true مثدار `elemA.contains(elemB)` باشد، عبارت `elemA==elemB` یا وقتی که (`elemA` از فرزندان) باشد `elemA` داخل `elemB` اگر -
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.را برمی‌گرداند true مثدار `elemA.contains(elemB)` باشد، عبارت `elemA==elemB` یا وقتی که (`elemA` از فرزندان) باشد `elemA` داخل `elemB` اگر -
.را برمی‌گرداند true مقدار `elemA.contains(elemB)` باشد، عبارت `elemA==elemB` یا وقتی که (`elemA` از فرزندان) باشد `elemA` داخل `elemB` اگر -

alert(elem); // 5
</script>
```

```warn header="Please don't use id-named global variables to access elements"
This behavior is described [in the specification](https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object), but it is supported mainly for compatibility.
```warn header=".ها استفاده نکنیدelement برای دسترسی به global لفطا از متغیرهای"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```warn header=".ها استفاده نکنیدelement برای دسترسی به global لفطا از متغیرهای"
```warn header=".ها استفاده نکنیدelement برای دسترسی به global لطفا از متغیرهای"


How to find?...
چگونه پیدا کنیم؟
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
چگونه پیدا کنیم؟
چگونه ... را پیدا کنیم؟

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
چگونه پیدا کنیم؟
چگونه موارد زیر را پیدا کنیم؟

The ellipsis refers to the follow-up lines.

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@mahdiHash
Copy link
Contributor

Thanks for the review, @alivarastepour :D

@shahrzadJavadiKoushesh
Copy link
Contributor Author

/done

Copy link
Member

@mahdyar mahdyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mahdiHash
Copy link
Contributor

Thanks for your contribution, @shahrzadJavadiKoushesh :D

@mahdiHash mahdiHash merged commit 950fd4b into javascript-tutorial:master Jul 31, 2023
@javascript-translate-bot

Thank you 💖 I updated the Progress Issue #1 🎉 🎉 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants