Skip to content

Commit 8dd2bcc

Browse files
authored
Merge pull request #187 from msisaifu/node-properties
Node properties: type, tag and contents
2 parents 21656e0 + 87ac013 commit 8dd2bcc

File tree

9 files changed

+196
-196
lines changed

9 files changed

+196
-196
lines changed

2-ui/1-document/05-basic-dom-node-properties/2-lastchild-nodetype-inline/solution.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
There's a catch here.
1+
এখানে লক্ষ্য করুন।
22

3-
At the time of `<script>` execution the last DOM node is exactly `<script>`, because the browser did not process the rest of the page yet.
3+
`<script>` টি যখন এক্সিকিউশন হবে শেষ DOM নোডটি হবে `<script>`, কেননা ব্রাউজার সম্পূর্ন পেজটি এক্সিকিউট হয়নি।
44

5-
So the result is `1` (element node).
5+
সুতরাং ফলাফল দেখাবে `1` (এলিমেন্ট নোড)।
66

77
```html run height=60
88
<html>

2-ui/1-document/05-basic-dom-node-properties/2-lastchild-nodetype-inline/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# What's in the nodeType?
5+
# এটি কি ধরণের নোডটাইপ?
66

7-
What does the script show?
7+
স্ক্রিপ্টটি কি দেখাবে?
88

99
```html
1010
<html>
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
Let's make a loop over `<li>`:
1+
প্রথমে `<li>` এর কালেকশনটি নেয়:
22

33
```js
44
for (let li of document.querySelectorAll('li')) {
55
...
66
}
77
```
88

9-
In the loop we need to get the text inside every `li`.
9+
লুপের মধ্যে আমাদের প্রতিটি `li` এর টেক্সট নেয়া লাগবে।
1010

11-
We can read the text from the first child node of `li`, that is the text node:
11+
আমরা `li` এর প্রথম নোডটি থেকে নোড এর কন্টেন্ট পাব, যা হল টেক্সট নোড:
1212

1313
```js
1414
for (let li of document.querySelectorAll('li')) {
@@ -18,4 +18,4 @@ for (let li of document.querySelectorAll('li')) {
1818
}
1919
```
2020

21-
Then we can get the number of descendants as `li.getElementsByTagName('li').length`.
21+
এরপর আমরা এভাবে সর্বমোট চাইল্ডনোড সমূহ পাব `li.getElementsByTagName('li').length`

2-ui/1-document/05-basic-dom-node-properties/2-tree-info/task.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ importance: 5
44

55
# Count descendants
66

7-
There's a tree structured as nested `ul/li`.
7+
একটি নেস্টেড ট্রি স্ট্রাকচার্ড আছে `ul/li`
88

9-
Write the code that for each `<li>` shows:
9+
একটি কোড লিখুন যা প্রতিটি `<li>` এর কন্টেন্ট কে দেখাবে:
1010

11-
1. What's the text inside it (without the subtree)
12-
2. The number of nested `<li>` -- all descendants, including the deeply nested ones.
11+
1. ভিতরের টেক্সটটি দেখাবেন (সাবট্রি ব্যতীত)
12+
2. `<li>` -- এর মধ্যে সর্বমোট ডিপ নেস্টেড সহ কতটি নেস্টেড এলিমেন্ট আছে?
1313

1414
[demo src="solution"]
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The answer: **`BODY`**.
1+
এটি দেখাবে: **`BODY`**
22

33
```html run
44
<script>
@@ -10,8 +10,8 @@ The answer: **`BODY`**.
1010
</script>
1111
```
1212

13-
What's going on step by step:
13+
এখানে কি হচ্ছে তা ধাপে ধাপে দেখি:
1414

15-
1. The content of `<body>` is replaced with the comment. The comment is `<!--BODY-->`, because `body.tagName == "BODY"`. As we remember, `tagName` is always uppercase in HTML.
16-
2. The comment is now the only child node, so we get it in `body.firstChild`.
17-
3. The `data` property of the comment is its contents (inside `<!--...-->`): `"BODY"`.
15+
1. `<body>` এর কন্টেন্টটি কমেন্ট দ্বারা প্রতিস্থাপিত হবে। কমেন্টটি হল `<!--BODY-->`, কেননা `body.tagName == "BODY"`। এবং আমরা জানি, `tagName` সর্বদা বড়হাতের হয়।
16+
2. কমেন্টটি হল একমাত্র চাইল্ড নোড, সুতরাং আমরা একে `body.firstChild` প্রপার্টিতে পাব।
17+
3. কমেন্ট এর কন্টেন্ট হল `"BODY"` যা আমরা `data` প্রপার্টিতে পাব।

2-ui/1-document/05-basic-dom-node-properties/3-tag-in-comment/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 3
44

55
# Tag in comment
66

7-
What does this code show?
7+
কোডটি কি দেখাবে?
88

99
```html
1010
<script>
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11

2-
We can see which class it belongs by outputting it, like:
2+
আমরা এভাবে এর ক্লাস নামটি দেখতে পারি:
33

44
```js run
55
alert(document); // [object HTMLDocument]
66
```
77

8-
Or:
8+
অথবা:
99

1010
```js run
1111
alert(document.constructor.name); // HTMLDocument
1212
```
1313

14-
So, `document` is an instance of `HTMLDocument` class.
14+
সুতরাং, `document` হল `HTMLDocument` ক্লাসের ইন্সট্যান্স।
1515

16-
What's its place in the hierarchy?
16+
চলুন হায়ার্য়াকি অনুযায়ী আরো বিস্তারিত দেখি
1717

18-
Yeah, we could browse the specification, but it would be faster to figure out manually.
18+
আমরা স্পেসিফিকেশন দেখে এই ব্যাপারে জানতে পারি, কিন্তু আমরা কোড করেও এর বিস্তারিত দেখতে পারি।
1919

20-
Let's traverse the prototype chain via `__proto__`.
20+
চলুন আমরা `__proto__` প্রটোটাইপ চেইন ট্রাভার্স করি।
2121

22-
As we know, methods of a class are in the `prototype` of the constructor. For instance, `HTMLDocument.prototype` has methods for documents.
22+
আমরা জানি, ক্লাসের মেথডসমূহ `prototype` দ্বারা constructor কে নির্দেশিত করে। যেমন, `HTMLDocument.prototype` এ ডকুমেন্ট এর মেথড আছে।
2323

24-
Also, there's a reference to the constructor function inside the `prototype`:
24+
এছাড়াও, `prototype` এর constructor এ এর উল্লেখ আছে:
2525

2626
```js run
2727
alert(HTMLDocument.prototype.constructor === HTMLDocument); // true
2828
```
2929

30-
To get a name of the class as a string, we can use `constructor.name`. Let's do it for the whole `document` prototype chain, till class `Node`:
30+
ক্লাস নামটিকে কে আমরা স্ট্রিং আকারে পেতে, `constructor.name` ব্যবহার করতে পারি। চলুন আমরা `document` এর প্রটোটাইপ চেইন ট্রাভার্স করি, যতক্ষণ পর্যন্ত `Node` ক্লাসটি না পায়:
3131

3232
```js run
3333
alert(HTMLDocument.prototype.constructor.name); // HTMLDocument
3434
alert(HTMLDocument.prototype.__proto__.constructor.name); // Document
3535
alert(HTMLDocument.prototype.__proto__.__proto__.constructor.name); // Node
3636
```
3737

38-
That's the hierarchy.
38+
এটিই document এর হায়ার্য়াকি।
3939

40-
We also could examine the object using `console.dir(document)` and see these names by opening `__proto__`. The console takes them from `constructor` internally.
40+
আমরা `console.dir(document)` এর সাহায্যেও দেখতে পারি, এবং `__proto__` তে ক্লিক করে প্রত্যেকটির নাম দেখতে পাব। কনসোল ইন্টার্নালি `constructor` সমূহ নেয়।

2-ui/1-document/05-basic-dom-node-properties/4-where-document-in-hierarchy/task.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ importance: 4
22

33
---
44

5-
# Where's the "document" in the hierarchy?
5+
# "document" এর হায়ার্য়াকি
66

7-
Which class does the `document` belong to?
7+
`document` কোন ক্লাসের অন্তর্গত?
88

9-
What's its place in the DOM hierarchy?
9+
DOM হায়ার্য়াকি তে এর অবস্থান কি?
1010

11-
Does it inherit from `Node` or `Element`, or maybe `HTMLElement`?
11+
এটি কি `Node` বা `Element`, অথবা `HTMLElement` কে ইনহেরিট করে?

0 commit comments

Comments
 (0)