From 2cc0d650fe320944d28299be87f1a3ebca4d4de9 Mon Sep 17 00:00:00 2001 From: sagit2002 Date: Sun, 8 Mar 2020 13:00:39 +0530 Subject: [PATCH] Translated 02-dom-nodes/task.md --- .../03-dom-navigation/1-dom-children/solution.md | 15 +++++++-------- .../03-dom-navigation/1-dom-children/task.md | 12 ++++++------ .../3-navigation-links-which-null/solution.md | 8 ++++---- .../3-navigation-links-which-null/task.md | 8 ++++---- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/2-ui/1-document/03-dom-navigation/1-dom-children/solution.md b/2-ui/1-document/03-dom-navigation/1-dom-children/solution.md index decfa62c7..7553ca330 100644 --- a/2-ui/1-document/03-dom-navigation/1-dom-children/solution.md +++ b/2-ui/1-document/03-dom-navigation/1-dom-children/solution.md @@ -1,17 +1,16 @@ -There are many ways, for instance: +ਇੱਥੇ ਬਹੁਤ ਸਾਰੇ ਤਰੀਕੇ ਹਨ, ਉਦਾਹਰਣ ਵਜੋਂ: - -The `
` DOM node: +`
` DOM ਨੋਡ: ```js document.body.firstElementChild -// or +// ਜਾਂ document.body.children[0] -// or (the first node is space, so we take 2nd) +// ਜਾਂ (ਪਹਿਲਾ ਨੋਡ ਸਪੇਸ ਹੈ, ਇਸਲਈ ਅਸੀਂ ਦੂਜਾ ਸਥਾਨ ਲੈਂਦੇ ਹਾਂ) document.body.childNodes[1] ``` -The `
    ` DOM node: +`
      `DOM ਨੋਡ: ```js document.body.lastElementChild @@ -19,9 +18,9 @@ document.body.lastElementChild document.body.children[1] ``` -The second `
    • ` (with Pete): +ਦੂਜਾ`
    • ` (ਪੀਟ ਨਾਲ): ```js -// get
        , and then get its last element child +// ਪ੍ਰਾਪਤ ਕਰੋ
          ,ਅਤੇ ਫਿਰ ਇਸ ਦਾ ਆਖਰੀ ਏਲੇਮੈਂਟ ਵਾਲਾ ਬੱਚਾ ਪ੍ਰਾਪਤ ਕਰੋ document.body.lastElementChild.lastElementChild ``` diff --git a/2-ui/1-document/03-dom-navigation/1-dom-children/task.md b/2-ui/1-document/03-dom-navigation/1-dom-children/task.md index d97f2748a..c751f8ce6 100644 --- a/2-ui/1-document/03-dom-navigation/1-dom-children/task.md +++ b/2-ui/1-document/03-dom-navigation/1-dom-children/task.md @@ -2,9 +2,9 @@ importance: 5 --- -# DOM children +# DOM ਬੱਚੇ -Look at this page: +ਇਸ ਪੇਜ ਨੂੰ ਵੇਖੋ: ```html @@ -18,7 +18,7 @@ Look at this page: ``` -For each of the following, give at least one way of how to access them: -- The `
          ` DOM node? -- The `
            ` DOM node? -- The second `
          • ` (with Pete)? +ਹੇਠ ਲਿਖਿਆਂ ਵਿੱਚੋਂ ਹਰੇਕ ਲਈ, ਉਹਨਾਂ ਤੱਕ ਪਹੁੰਚਣ ਦੇ ਤਰੀਕੇ ਦਾ ਘੱਟੋ ਘੱਟ ਇੱਕ ਢੰਗ ਦਿਓ: +- `
            `DOM ਨੋਡ? +- `
              ` DOM ਨੋਡ? +- ਦੂਜਾ `
            • ` (ਪੀਟ ਨਾਲ)? diff --git a/2-ui/1-document/03-dom-navigation/3-navigation-links-which-null/solution.md b/2-ui/1-document/03-dom-navigation/3-navigation-links-which-null/solution.md index d76936320..63392f146 100644 --- a/2-ui/1-document/03-dom-navigation/3-navigation-links-which-null/solution.md +++ b/2-ui/1-document/03-dom-navigation/3-navigation-links-which-null/solution.md @@ -1,6 +1,6 @@ -1. Yes, true. The element `elem.lastChild` is always the last one, it has no `nextSibling`. -2. No, wrong, because `elem.children[0]` is the first child *among elements*. But there may exist non-element nodes before it. So `previousSibling` may be a text node. +1. ਹਾਂ ਸਹੀ. ਏਲੇਮੈਂਟ `elem.lastChild` ਹਮੇਸ਼ਾਂ ਆਖਰੀ ਹੁੰਦਾ ਹੈ, ਇਸਦਾ ਕੋਈ ਸਮਕਸ਼ ਨਹੀਂ ਹੁੰਦਾ `nextSibling`. +2. ਨਹੀਂ, ਗਲਤ, ਕਿਉਂਕਿ `elem.children[0]` ਪਹਿਲਾ ਬੱਚਾ ਹੈ *among elements*. ਪਰ ਇਸ ਤੋਂ ਪਹਿਲਾਂ ਗੈਰ-ਏਲੇਮੈਂਟ ਨੋਡ ਮੌਜੂਦ ਹੋ ਸਕਦੇ ਹਨ. ਇਸ ਲਈ`previousSibling` ਟੈਕਸਟ ਨੋਡ ਹੋ ਸਕਦਾ ਹੈ. -Please note: for both cases if there are no children, then there will be an error. +ਕਿਰਪਾ ਕਰਕੇ ਨੋਟ ਕਰੋ: ਦੋਵਾਂ ਮਾਮਲਿਆਂ ਲਈ ਜੇ ਕੋਈ ਬੱਚੇ ਨਹੀਂ ਹਨ, ਤਾਂ ਏਹ ਇੱਕ ਗਲਤੀ ਹੋਏਗੀ. -If there are no children, `elem.lastChild` is `null`, so we can't access `elem.lastChild.nextSibling`. And the collection `elem.children` is empty (like an empty array `[]`). +ਜੇ ਕੋਈ ਬੱਚੇ ਨਹੀਂ ਹਨ, `elem.lastChild` ਹੈ `null`, ਇਸ ਲਈ ਅਸੀਂ ਐਕਸੈਸ ਨਹੀਂ ਕਰ ਸਕਦੇ `elem.lastChild.nextSibling`. ਅਤੇ ਸੰਗ੍ਰਹਿ`elem.children` ਖਾਲੀ ਹੈ (ਖਾਲੀ ਐਰੇ ਵਾਂਗ `[]`). diff --git a/2-ui/1-document/03-dom-navigation/3-navigation-links-which-null/task.md b/2-ui/1-document/03-dom-navigation/3-navigation-links-which-null/task.md index 235e83a0c..8ea77aaa7 100644 --- a/2-ui/1-document/03-dom-navigation/3-navigation-links-which-null/task.md +++ b/2-ui/1-document/03-dom-navigation/3-navigation-links-which-null/task.md @@ -2,9 +2,9 @@ importance: 5 --- -# The sibling question +# ਭੈਣ ਭਰਾ ਸਵਾਲ -If `elem` -- is an arbitrary DOM element node... +If `elem` -- ਇੱਕ ਅਸਥਾਈ DOM ਐਲੀਮੈਂਟ ਨੋਡ ਹੈ... -- Is it true that `elem.lastChild.nextSibling` is always `null`? -- Is it true that `elem.children[0].previousSibling` is always `null` ? +- ਕੀ ਇਹ ਸੱਚ ਹੈ? `elem.lastChild.nextSibling` ਹਮੇਸ਼ਾ ਹੁੰਦਾ ਹੈ `null`? +- ਕੀ ਇਹ ਸੱਚ ਹੈ? `elem.children[0].previousSibling` ਹਮੇਸ਼ਾ ਹੁੰਦਾ ਹੈ `null` ?