diff --git a/2-ui/1-document/05-basic-dom-node-properties/2-lastchild-nodetype-inline/solution.md b/2-ui/1-document/05-basic-dom-node-properties/2-lastchild-nodetype-inline/solution.md index 52c34640a..cb6dffc50 100644 --- a/2-ui/1-document/05-basic-dom-node-properties/2-lastchild-nodetype-inline/solution.md +++ b/2-ui/1-document/05-basic-dom-node-properties/2-lastchild-nodetype-inline/solution.md @@ -1,8 +1,8 @@ -There's a catch here. +هناك صيد هنا. -At the time of ` ``` -What's going on step by step: +ما يحدث خطوة بخطوة: -1. The content of `
` is replaced with the comment. The comment is ``, because `body.tagName == "BODY"`. As we remember, `tagName` is always uppercase in HTML. -2. The comment is now the only child node, so we get it in `body.firstChild`. -3. The `data` property of the comment is its contents (inside ``): `"BODY"`. +1. يتم استبدال محتوى "" بالتعليق. التعليق هو `` ، لأن `body.tagName ==" BODY "`. كما نتذكر ، فإن `tagName` دائمًا ما تكون أحرفًا كبيرة بتنسيق HTML. +2. التعليق هو الآن العقدة الفرعية الوحيدة ، لذلك نحصل عليه في `body.firstChild`. +3. خاصية "البيانات" للتعليق هي محتوياته (داخل ``): "" BODY "`. diff --git a/2-ui/1-document/05-basic-dom-node-properties/3-tag-in-comment/task.md b/2-ui/1-document/05-basic-dom-node-properties/3-tag-in-comment/task.md index efe50b48f..cfc493229 100644 --- a/2-ui/1-document/05-basic-dom-node-properties/3-tag-in-comment/task.md +++ b/2-ui/1-document/05-basic-dom-node-properties/3-tag-in-comment/task.md @@ -1,10 +1,10 @@ -importance: 3 +درجة الأهمية: 3 --- -# Tag in comment +# تاج في تعليق -What does this code show? +ماذا يبين هذا الكود؟ ```html ``` -**Beware: unlike `innerHTML`, writing to `outerHTML` does not change the element. Instead, it replaces it in the DOM.** +** احذر: على عكس "innerHTML" ، لا تؤدي الكتابة إلى "outerHTML" إلى تغيير العنصر. بدلاً من ذلك ، يتم استبداله في DOM. ** -Yeah, sounds strange, and strange it is, that's why we make a separate note about it here. Take a look. +نعم ، يبدو غريبًا ، وغريبًا ، لهذا السبب نقوم بعمل ملاحظة منفصلة عنه هنا. إلق نظرة. -Consider the example: +تأمل في المثال: ```html runA new element
`. In the outer document (the DOM) we can see the new content instead of the `عنصر جديد p> `. في المستند الخارجي (DOM) ، يمكننا رؤية المحتوى الجديد بدلاً من `
A new element
` was inserted in its place. -- `div` still has its old value. The new HTML wasn't saved to any variable. +ما حدث في `div.outerHTML = ...` هو: +- تمت إزالة `div` من المستند. +- تم إدراج جزء آخر من HTML "عنصر جديد p>" في مكانه. +- `div` لا تزال لها قيمتها القديمة. لم يتم حفظ HTML الجديد في أي متغير. -It's so easy to make an error here: modify `div.outerHTML` and then continue to work with `div` as if it had the new content in it. But it doesn't. Such thing is correct for `innerHTML`, but not for `outerHTML`. +من السهل جدًا ارتكاب خطأ هنا: قم بتعديل `div.outerHTML` ثم تابع العمل مع` div` كما لو كان به محتوى جديد فيه. لكنها لا تفعل ذلك. هذا الشيء صحيح بالنسبة لـ "innerHTML" ، ولكن ليس لـ "outerHTML". -We can write to `elem.outerHTML`, but should keep in mind that it doesn't change the element we're writing to ('elem'). It puts the new HTML in its place instead. We can get references to the new elements by querying the DOM. +يمكننا الكتابة إلى "elem.outerHTML" ، ولكن يجب أن نضع في اعتبارنا أنه لا يغير العنصر الذي نكتب إليه ("elem"). بدلاً من ذلك ، تضع HTML الجديد في مكانه. يمكننا الحصول على مراجع للعناصر الجديدة عن طريق الاستعلام عن DOM. -## nodeValue/data: text node content +## nodeValue / data: محتوى عقدة النص -The `innerHTML` property is only valid for element nodes. +خاصية `innerHTML` صالحة لعقد العناصر فقط. -Other node types, such as text nodes, have their counterpart: `nodeValue` and `data` properties. These two are almost the same for practical use, there are only minor specification differences. So we'll use `data`, because it's shorter. +أنواع العقد الأخرى ، مثل العقد النصية ، لها نظيرها: خصائص `nodeValue` و` data`. هذان النوعان متشابهان تقريبًا للاستخدام العملي ، ولا توجد سوى اختلافات طفيفة في المواصفات. لذا سنستخدم "البيانات" لأنها أقصر. -An example of reading the content of a text node and a comment: +مثال على قراءة محتوى العقدة النصية والتعليق: ```html run height="50"
@@ -349,9 +348,9 @@ An example of reading the content of a text node and a comment: ``` -For text nodes we can imagine a reason to read or modify them, but why comments? +بالنسبة للعقد النصية ، يمكننا تخيل سبب لقراءتها أو تعديلها ، ولكن لماذا التعليقات؟ -Sometimes developers embed information or template instructions into HTML in them, like this: +في بعض الأحيان يقوم المطورون بتضمين معلومات أو تعليمات قالب في HTML ، مثل هذا: ```html @@ -359,13 +358,13 @@ Sometimes developers embed information or template instructions into HTML in the ``` -...Then JavaScript can read it from `data` property and process embedded instructions. +... ثم يمكن لجافا سكريبت قراءته من خاصية `البيانات` ومعالجة التعليمات المضمنة. -## textContent: pure text +## textContent: نص خالص -The `textContent` provides access to the *text* inside the element: only text, minus all `