Skip to content

Commit 506c67d

Browse files
author
abdelrhman_ali
committed
translate Browser environment, specs into AR
1 parent dd3838b commit 506c67d

1 file changed

Lines changed: 60 additions & 51 deletions

File tree

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,124 @@
1-
# Browser environment, specs
1+
# بيئة المتصفح ومواصفاته
22

3-
The JavaScript language was initially created for web browsers. Since then it has evolved and become a language with many uses and platforms.
3+
تم إنشاء لغة javascript فى البداية لمتصفحات الويب , منذ ذلك الحين وأصبح لها استخدمات ومنصات عديدة.
44

5-
A platform may be a browser, or a web-server or another *host*, even a coffee machine. Each of them provides platform-specific functionality. The JavaScript specification calls that a *host environment*.
5+
قد تكون تلك المنصة متصفح , خادم ويب او مضيف آخر ولكن لكل واحد منهم وظيفته الخاصة التى يقوم بها .خصائص الjavascript تسمى هذا بيئة المضيف.
66

7-
A host environment provides own objects and functions additional to the language core. Web browsers give a means to control web pages. Node.js provides server-side features, and so on.
7+
توفر بيئة العمل كائنات و وظائف خاصة إلى جزهر اللغة , تعتبر المتصفحات وسيلة للتحكم بصفحات الويب , وتوفر الnode.js خواص إلى جانب الخادم, وما إلى ذلك.
88

9-
Here's a bird's-eye view of what we have when JavaScript runs in a web-browser:
9+
إليك نظرة شاملة لما لدينا عند تشغيل جافا سكريبت في متصفح ويب:
1010

1111
![](windowObjects.svg)
1212

13-
There's a "root" object called `window`. It has two roles:
13+
لدينا كائن الجذر `window` , له دورين:
1414

15-
1. First, it is a global object for JavaScript code, as described in the chapter <info:global-object>.
16-
2. Second, it represents the "browser window" and provides methods to control it.
15+
1. أولا, هو كائن عالمى لشفرة javascript ,كما وصِف فى فصل <info:global-object>
1716

18-
For instance, here we use it as a global object:
17+
2. ثانيًا ، يمثل "نافذة المتصفح" ويوفر طرقًا للتحكم فيها.
18+
19+
على سبيل المثال ، نستخدمها هنا ككائن عام:
1920

2021
```js run
2122
function sayHi() {
2223
alert("Hello");
2324
}
2425

25-
// global functions are methods of the global object:
26+
// الدالات العامة هي طرق الكائن العام:
2627
window.sayHi();
2728
```
2829

29-
And here we use it as a browser window, to see the window height:
30+
وهنا نستخدمها كنافذة متصفح لرؤية ارتفاع النافذة:
3031

3132
```js run
32-
alert(window.innerHeight); // inner window height
33+
alert(window.innerHeight); // ارتفاع النافذة الداخلية
3334
```
3435

35-
There are more window-specific methods and properties, we'll cover them later.
36+
هناك المزيد من الأساليب والخصائص الخاصة بالنافذة ، وسنغطيها لاحقًا.
3637

3738
## DOM (Document Object Model)
3839

39-
Document Object Model, or DOM for short, represents all page content as objects that can be modified.
40+
يمثل نموذج كائن المستند ، أو اختصار DOM ، محتوى الصفحة بالكامل ككائنات يمكن تعديلها.
41+
42+
كائن `document` هو "نقطة الدخول" الرئيسية للصفحة. يمكننا تغيير أو إنشاء أي شيء على الصفحة باستخدامه.
4043

41-
The `document` object is the main "entry point" to the page. We can change or create anything on the page using it.
44+
على سبيل المثال:
4245

43-
For instance:
4446
```js run
45-
// change the background color to red
47+
// تغيير لون الخلفية إلى اللون الأحمر
4648
document.body.style.background = "red";
4749

48-
// change it back after 1 second
49-
setTimeout(() => document.body.style.background = "", 1000);
50+
// تغييره مرة أخرى بعد ثانية واحدة
51+
setTimeout(() => (document.body.style.background = ""), 1000);
5052
```
5153

52-
Here we used `document.body.style`, but there's much, much more. Properties and methods are described in the specification:
54+
استخدمنا هنا `document.body.style` ، ولكن هناك الكثير والكثير. يتم وصف الخصائص والأساليب في المواصفات:
5355

54-
- **DOM Living Standard** at <https://dom.spec.whatwg.org>
56+
- **DOM الحالة القياسية** فى <https://dom.spec.whatwg.org>
5557

56-
```smart header="DOM is not only for browsers"
57-
The DOM specification explains the structure of a document and provides objects to manipulate it. There are non-browser instruments that use DOM too.
58+
```smart header="DOM ليس فقط للمتصفحات"
59+
توضح مواصفات DOM بنية المستند وتوفر كائنات لمعالجته. هناك أدوات غير متصفح تستخدم DOM أيضًا.
5860
59-
For instance, server-side scripts that download HTML pages and process them can also use DOM. They may support only a part of the specification though.
61+
على سبيل المثال ، يمكن للبرامج النصية من جانب الخادم التي تقوم بتنزيل صفحات HTML ومعالجتها أيضًا استخدام DOM. قد يدعمون جزءًا فقط من المواصفات بالرغم من ذلك.
6062
```
6163

62-
```smart header="CSSOM for styling"
63-
CSS rules and stylesheets are structured in a different way than HTML. There's a separate specification, [CSS Object Model (CSSOM)](https://www.w3.org/TR/cssom-1/), that explains how they are represented as objects, and how to read and write them.
64+
```smart header="CSSOM للتصنيف"
65+
يتم تنظيم قواعد CSS وأوراق الأنماط بطريقة مختلفة عن HTML. هناك مواصفات منفصلة ، [CSS Object Model (CSSOM)](https://www.w3.org/TR/cssom-1/), يشرح كيف يتم تمثيلها ككائنات ، وكيفية قراءتها وكتابتها.
66+
them.
6467
65-
CSSOM is used together with DOM when we modify style rules for the document. In practice though, CSSOM is rarely required, because usually CSS rules are static. We rarely need to add/remove CSS rules from JavaScript, but that's also possible.
68+
يتم استخدام CSSOM مع DOM عند تعديل قواعد النمط للمستند. من الناحية العملية ، نادرًا ما تكون CSSOM مطلوبة ، لأن قواعد CSS عادة ما تكون ثابتة. نادرًا ما نحتاج إلى إضافة / إزالة قواعد CSS من JavaScript ، ولكن هذا ممكن أيضًا.
6669
```
6770

6871
## BOM (Browser Object Model)
6972

70-
The Browser Object Model (BOM) represents additional objects provided by the browser (host environment) for working with everything except the document.
73+
يمثل نموذج كائن المتصفح (BOM) كائنات إضافية يوفرها المتصفح (البيئة المضيفة) للعمل مع كل شيء باستثناء المستند.
74+
75+
على سبيل المثال:
7176

72-
For instance:
77+
- يوفر كائن [navigator](mdn:api/Window/navigator) معلومات أساسية حول المتصفح ونظام التشغيل. هناك العديد من الخصائص ، لكن الأكثر شهرة هما:
78+
`navigator.userAgent` -- حول المتصفح الحالي ، و `navigator.platform` -- حول النظام الأساسي (يمكن أن يساعد على الاختلاف بين Windows / Linux / Mac إلخ).
7379

74-
- The [navigator](mdn:api/Window/navigator) object provides background information about the browser and the operating system. There are many properties, but the two most widely known are: `navigator.userAgent` -- about the current browser, and `navigator.platform` -- about the platform (can help to differ between Windows/Linux/Mac etc).
75-
- The [location](mdn:api/Window/location) object allows us to read the current URL and can redirect the browser to a new one.
80+
- يسمح لنا كائن [location](mdn:api/Window/location) بقراءة عنوان URL الحالي ويمكنه إعادة توجيه المتصفح إلى عنوان جديد.
7681

77-
Here's how we can use the `location` object:
82+
إليك كيفية استخدام كائن `location`:
7883

7984
```js run
80-
alert(location.href); // shows current URL
85+
alert(location.href); //يظهر URL الحالى
8186
if (confirm("Go to Wikipedia?")) {
82-
location.href = "https://wikipedia.org"; // redirect the browser to another URL
87+
location.href = "https://wikipedia.org"; //إعادة توجيه المتصفح إلى عنوان URL آخر
8388
}
8489
```
8590

86-
Functions `alert/confirm/prompt` are also a part of BOM: they are directly not related to the document, but represent pure browser methods of communicating with the user.
91+
تعد `alert/confirm/prompt` الوظائف أيضًا جزءًا من DOM المواد: فهي لا تتعلق مباشرة بالمستند ، ولكنها تمثل طرق متصفح خالصة للتواصل مع المستخدم.
8792

88-
```smart header="Specifications"
89-
BOM is the part of the general [HTML specification](https://html.spec.whatwg.org).
93+
```smart header="مواصفات"
94+
BOM هو جزء من مواصفات[HTML specification](https://html.spec.whatwg.org).
9095
91-
Yes, you heard that right. The HTML spec at <https://html.spec.whatwg.org> is not only about the "HTML language" (tags, attributes), but also covers a bunch of objects, methods and browser-specific DOM extensions. That's "HTML in broad terms". Also, some parts have additional specs listed at <https://spec.whatwg.org>.
96+
نعم سمعت ذلك جيدا. مواصفات HTML في <https://html.spec.whatwg.org>لا تتعلق فقط بـ "لغة HTML" (العلامات ، السمات) ،ولكنه يغطي أيضًا مجموعة من الكائنات والأساليب وإضافات DOM الخاصة بالمتصفح. هذا هو "HTML بعبارات عامة".أيضًا ، تحتوي بعض الأجزاء على مواصفات إضافية مدرجة في <https://spec.whatwg.org>
9297
```
9398

94-
## Summary
99+
## ملخص
95100

96-
Talking about standards, we have:
101+
بالحديث عن المعايير ، لدينا:
97102

98-
DOM specification
99-
: Describes the document structure, manipulations and events, see <https://dom.spec.whatwg.org>.
103+
DOM مواصفات
104+
: يصف هيكل الوثيقة والتلاعب والأحداث ، راجع <https://dom.spec.whatwg.org>.
100105

101-
CSSOM specification
102-
: Describes stylesheets and style rules, manipulations with them and their binding to documents, see <https://www.w3.org/TR/cssom-1/>.
106+
CSSOM مواصفات
107+
: يصف أوراق الأنماط وقواعد الأنماط والتلاعب بها وربطها بالمستندات ، راجع <https://www.w3.org/TR/cssom-1/>.
103108

104-
HTML specification
105-
: Describes the HTML language (e.g. tags) and also the BOM (browser object model) -- various browser functions: `setTimeout`, `alert`, `location` and so on, see <https://html.spec.whatwg.org>. It takes the DOM specification and extends it with many additional properties and methods.
109+
HTML مواصفات
110+
: تصف لغة HTML (مثل العلامات) وكذلك BOM (طراز كائن المتصفح) - وظائف المتصفح المختلفة:
111+
`setTimeout`, `alert`, `location` وما إلى ذلك, راجع <https://html.spec.whatwg.org>. يأخذ مواصفات DOM ويوسعها بالعديد من الخصائص والأساليب الإضافية.
106112

107-
Additionally, some classes are described separately at <https://spec.whatwg.org/>.
113+
بالإضافة إلى ذلك ، يتم وصف بعض الفئات بشكل منفصل في
114+
<https://spec.whatwg.org/>.
108115

109-
Please note these links, as there's so much stuff to learn it's impossible to cover and remember everything.
116+
يرجى ملاحظة هذه الروابط ، حيث أن هناك الكثير من الأشياء لمعرفة أنه من المستحيل تغطية وتذكر كل شيء.
110117

111-
When you'd like to read about a property or a method, the Mozilla manual at <https://developer.mozilla.org/en-US/search> is also a nice resource, but the corresponding spec may be better: it's more complex and longer to read, but will make your fundamental knowledge sound and complete.
118+
عندما ترغب في القراءة عن خاصية أو طريقة ما ، فإن دليل Mozilla على
119+
<https://developer.mozilla.org/en-US/search> هو أيضًا مورد جيد ، ولكن المواصفات المقابلة قد تكون أفضل: إنها أكثر تعقيدًا وأطول وقتًا للقراءة ، ولكنها ستجعل معرفتك الأساسية سليمة وكاملة.
112120

113-
To find something, it's often convenient to use an internet search "WHATWG [term]" or "MDN [term]", e.g <https://google.com?q=whatwg+localstorage>, <https://google.com?q=mdn+localstorage>.
121+
للعثور على شيء ما ، غالبًا ما يكون من الملائم استخدام البحث على الإنترنت
122+
"WHATWG [مصطلح]" او "MDN [مصطلح]", e.g <https://google.com?q=whatwg+localstorage>, <https://google.com?q=mdn+localstorage>.
114123

115-
Now we'll get down to learning DOM, because the document plays the central role in the UI.
124+
سنبدأ الآن في تعلم DOM ، لأن المستند يلعب الدور المركزي في واجهة المستخدم.

0 commit comments

Comments
 (0)