-
Notifications
You must be signed in to change notification settings - Fork 58
Walking the DOM #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
longo-andrea
merged 24 commits into
javascript-tutorial:master
from
pasor1:article/03-dom-navigation
Mar 14, 2021
Merged
Walking the DOM #253
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ef63bf2
article/03-dom-navigation translation
pasor1 d5c565b
Update 2-ui/1-document/03-dom-navigation/1-dom-children/solution.md
pasor1 6deed96
Update 2-ui/1-document/03-dom-navigation/1-dom-children/task.md
pasor1 c015e27
Update 2-ui/1-document/03-dom-navigation/3-navigation-links-which-nul…
pasor1 4557521
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 d363b30
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 1aba349
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 9df42ed
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 d2eecdf
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 0518da5
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 1b501c2
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 26cffdc
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 ae1cd1b
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 118aca9
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 8bc67cd
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 771d257
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 1b4f429
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 735c0c7
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 2b1f720
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 2429e8a
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 56bb06b
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 8862cfb
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 613bbd2
Update 2-ui/1-document/03-dom-navigation/1-dom-children/solution.md
pasor1 042060b
Update 2-ui/1-document/03-dom-navigation/article.md
pasor1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
article/03-dom-navigation translation
- Loading branch information
commit ef63bf22e2d382218874db72a595f2cf0068acd0
There are no files selected for viewing
14 changes: 7 additions & 7 deletions
14
2-ui/1-document/03-dom-navigation/1-dom-children/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
There are many ways, for instance: | ||
|
||
|
||
The `<div>` DOM node: | ||
Il nodo DOM `<div>`: | ||
|
||
```js | ||
document.body.firstElementChild | ||
// or | ||
// oppure | ||
document.body.children[0] | ||
// or (the first node is space, so we take 2nd) | ||
// oppure (il primo nodo e' uno spazio, quindi prendiamo il secondo) | ||
pasor1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
document.body.childNodes[1] | ||
``` | ||
|
||
The `<ul>` DOM node: | ||
Il nodo DOM `<ul>`: | ||
|
||
```js | ||
document.body.lastElementChild | ||
// or | ||
// oppure | ||
document.body.children[1] | ||
``` | ||
|
||
The second `<li>` (with Pete): | ||
Il secondo `<li>` (con Pete): | ||
|
||
```js | ||
// get <ul>, and then get its last element child | ||
// prendi <ul>, e quindi il suo ultimo elemento figlio | ||
document.body.lastElementChild.lastElementChild | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
2-ui/1-document/03-dom-navigation/3-navigation-links-which-null/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. Si, è vero. L'elemento `elem.lastChild` è sempre l'ultimo, non ha `nextSibling`. | ||
2. No, è falso, perché `elem.children[0]` è il primo figlio tra i nodi di tipo *elemento*, ma potrebbero esserci nodi di tipo diverso. Ad esempio `previousSibling` potrebbe essere un nodo di testo. | ||
|
||
Please note: for both cases if there are no children, then there will be an error. | ||
Nota: in entrambi i casi, se non ci sono figli si verificherà un errore. | ||
|
||
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 `[]`). | ||
Se non ci sono figli, `elem.lastChild` è `null`, quindi non possiamo accedere a `elem.lastChild.nextSibling`. E la collection `elem.children` sarà vuota (Come un array vuoto `[]`). | ||
pasor1 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
2-ui/1-document/03-dom-navigation/4-select-diagonal-cells/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
We'll be using `rows` and `cells` properties to access diagonal table cells. | ||
Useremo le proprietà `rows` e `cells` per accedere alle celle sulla diagonale della tabella. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ | |
<script> | ||
let table = document.body.firstElementChild; | ||
|
||
// your code | ||
// il tuo codice | ||
</script> | ||
</body> | ||
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.