Skip to content

Commit c54a876

Browse files
authored
Fix Conflicts 2/1/7 --mark -s
1 parent cfbcc8c commit c54a876

1 file changed

Lines changed: 9 additions & 87 deletions

File tree

2-ui/1-document/07-modifying-document/article.md

Lines changed: 9 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ DOM التعديل هو مفتاح إنشاء صفحات "حية".
2828
*/!*
2929
```
3030

31-
<<<<<<< HEAD
3231
كان هذا مثال HTML. الآن دعنا ننشئ نفس `div` باستخدام JavaScript (على افتراض أن الأنماط موجودة في HTML أو ملف CSS خارجي).
33-
=======
34-
That was the HTML example. Now let's create the same `div` with JavaScript (assuming that the styles are in the HTML/CSS already).
35-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
3632

3733
## إنشاء عنصر
3834

@@ -52,17 +48,11 @@ That was the HTML example. Now let's create the same `div` with JavaScript (assu
5248
let textNode = document.createTextNode('Here I am');
5349
```
5450

55-
<<<<<<< HEAD
56-
### إنشاء الرسالة
57-
58-
في حالتنا ، تكون الرسالة `div` مع فئة` تنبيه 'و HTML فيها:
59-
=======
60-
Most of the time we need to create element nodes, such as the `div` for the message.
51+
في حالتنا، تكون الرسالة `div` مع فئة` تنبيه 'و HTML فيها:
6152

62-
### Creating the message
53+
### إنشاء الرسالة
6354

64-
Creating the message div takes 3 steps:
65-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
55+
في حالتنا، إنشاء `div` الرسالة ينطلب 3 مراحل:
6656

6757
```js
6858
// 1. Create <div> element
@@ -75,73 +65,21 @@ div.className = "alert";
7565
div.innerHTML = "<strong>Hi there!</strong> You've read an important message.";
7666
```
7767

78-
<<<<<<< HEAD
79-
لقد أنشأنا العنصر ، ولكن حتى الآن إنه متغير فقط. لا يمكننا رؤية العنصر على الصفحة ، لأنه ليس جزءًا من المستند حتى الآن.
80-
=======
81-
We've created the element. But as of now it's only in a variable named `div`, not in the page yet. So we can't see it.
82-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
68+
لقد أنشأنا العنصر ، ولكن حتى الآن إنه متغير فقط. لا يمكننا رؤية العنصر على الصفحة ، لأنه ليس جزءًا من المستند حتى الآن
8369

8470
## طرق الإدراج
8571

86-
<<<<<<< HEAD
87-
لعرض "div" ، نحتاج إلى إدراجه في مكان ما في "المستند". على سبيل المثال ، في `document.body`.
88-
=======
89-
To make the `div` show up, we need to insert it somewhere into `document`. For instance, into `<body>` element, referenced by `document.body`.
90-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
91-
92-
هناك طريقة خاصة `append` لذلك:` document.body.append (div) `.
93-
94-
إليك الكود الكامل:
95-
96-
```html run height="80"
97-
<style>
98-
.alert {
99-
padding: 15px;
100-
border: 1px solid #d6e9c6;
101-
border-radius: 4px;
102-
color: #3c763d;
103-
background-color: #dff0d8;
104-
}
105-
</style>
72+
لعرض "div" ، نحتاج إلى إدراجه في مكان ما في "المستند". على سبيل المثال ، في `document.body`. هناك طريقة خاصة `append` لذلك:` document.body.append (div) `.
10673

107-
<script>
108-
let div = document.createElement('div');
109-
div.className = "alert";
110-
div.innerHTML = "<strong>Hi there!</strong> You've read an important message.";
111-
112-
*!*
113-
document.body.append(div);
114-
*/!*
115-
</script>
116-
```
117-
118-
<<<<<<< HEAD
11974
توفر هذه المجموعة من الطرق المزيد من الطرق لإدراج:
12075

12176
- `node.append (... nodes or strings)` - إلحاق عقد أو سلاسل في نهاية `node` ،
12277
- `node.prepend (... العقد أو السلاسل)` - إدراج العقد أو السلاسل في بداية `العقدة` ،
12378
- `node.before (... nodes or strings)` –- أدخل العقد أو السلاسل قبل `node` ،
124-
- `العقدة بعد (... العقد أو السلاسل)` - - إدراج العقد أو السلاسل بعد `العقدة` ،
79+
- `node.after(...nodes or strings)` - إدراج العقد أو السلاسل بعد `العقدة` ،
12580
- `node.replaceWith (... العقد أو السلاسل)` - - يستبدل `العقدة` بالعقد أو السلاسل المعطاة.
12681

12782
فيما يلي مثال على استخدام هذه الأساليب لإضافة عناصر إلى قائمة والنص قبلها / بعدها:
128-
=======
129-
Here we called `append` on `document.body`, but we can call `append` method on any other element, to put another element into it. For instance, we can append something to `<div>` by calling `div.append(anotherElement)`.
130-
131-
Here are more insertion methods, they specify different places where to insert:
132-
133-
- `node.append(...nodes or strings)` -- append nodes or strings *at the end* of `node`,
134-
- `node.prepend(...nodes or strings)` -- insert nodes or strings *at the beginning* of `node`,
135-
- `node.before(...nodes or strings)` –- insert nodes or strings *before* `node`,
136-
- `node.after(...nodes or strings)` –- insert nodes or strings *after* `node`,
137-
- `node.replaceWith(...nodes or strings)` –- replaces `node` with the given nodes or strings.
138-
139-
Arguments of these methods are an arbitrary list of DOM nodes to insert, or text strings (that become text nodes automatically).
140-
141-
Let's see them in action.
142-
143-
Here's an example of using these methods to add items to a list and the text before/after it:
144-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
14583

14684
```html autorun
14785
<ol id="ol">
@@ -164,11 +102,7 @@ Here's an example of using these methods to add items to a list and the text bef
164102
</script>
165103
```
166104

167-
<<<<<<< HEAD
168105
هذه صورة بصرية عن الأساليب التي تفعلها:
169-
=======
170-
Here's a visual picture of what the methods do:
171-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
172106

173107
![](before-prepend-append-after.svg)
174108

@@ -186,11 +120,7 @@ before
186120
after
187121
```
188122

189-
<<<<<<< HEAD
190123
يمكن لهذه الطرق إدراج قوائم متعددة للعقد والقطع النصية في مكالمة واحدة.
191-
=======
192-
As said, these methods can insert multiple nodes and text pieces in a single call.
193-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
194124

195125
على سبيل المثال ، هنا يتم إدراج سلسلة وعنصر:
196126

@@ -201,11 +131,7 @@ As said, these methods can insert multiple nodes and text pieces in a single cal
201131
</script>
202132
```
203133

204-
<<<<<<< HEAD
205-
يتم إدراج كل النص * كنص *.
206-
=======
207-
Please note: the text is inserted "as text", not "as HTML", with proper escaping of characters such as `<`, `>`.
208-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
134+
يتم إدراج كل النص * كنص *.
209135

210136
إذن HTML النهائي هو:
211137

@@ -221,11 +147,7 @@ Please note: the text is inserted "as text", not "as HTML", with proper escaping
221147

222148
لذلك ، لا يمكن استخدام هذه الطرق إلا لإدراج عقد DOM أو أجزاء نصية.
223149

224-
<<<<<<< HEAD
225-
ولكن ماذا لو أردنا إدراج HTML "كـ html" ، مع عمل جميع العلامات والأشياء ، مثل `elem.innerHTML`؟
226-
=======
227-
But what if we'd like to insert an HTML string "as html", with all tags and stuff working, in the same manner as `elem.innerHTML` does it?
228-
>>>>>>> 445bda39806050acd96f87166a7c97533a0c67e9
150+
ولكن ماذا لو أردنا إدراج HTML "كـ html" ، مع عمل جميع العلامات والأشياء ، مثل `elem.innerHTML`?
229151

230152
## insertAdjacentHTML / Text / Element
231153

@@ -604,4 +526,4 @@ ul.append(...getListContent()); // append + "..." operator = friends!
604526
- لإلحاق HTML بالصفحة قبل أن ينتهي التحميل:
605527
- `document.write (html)`
606528

607-
بعد تحميل الصفحة تقوم هذه المكالمة بمسح المستند. غالبا ما ينظر إليها في النصوص القديمة.
529+
بعد تحميل الصفحة تقوم هذه المكالمة بمسح المستند. غالبا ما ينظر إليها في النصوص القديمة.

0 commit comments

Comments
 (0)