Skip to content
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

Node properties: type, tag and contents #268

Merged
merged 17 commits into from
Mar 21, 2021
Merged

Node properties: type, tag and contents #268

merged 17 commits into from
Mar 21, 2021

Conversation

marcellosurdi
Copy link
Contributor

No description provided.

@CLAassistant
Copy link

CLAassistant commented Mar 20, 2021

CLA assistant check
All committers have signed the CLA.


We can read the text from the first child node of `li`, that is the text node:
Possiamo leggere il testo dal primo nodo figlio di `li` che è un nodo di testo:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Possiamo leggere il testo dal primo nodo figlio di `li` che è un nodo di testo:
Possiamo leggere il testo dal primo nodo figlio di `li`, che è un nodo di testo:

@@ -62,219 +63,217 @@ alert( document.body instanceof Node ); // true
alert( document.body instanceof EventTarget ); // true
```

As we can see, DOM nodes are regular JavaScript objects. They use prototype-based classes for inheritance.
Come possiamo notare i nodi DOM sono oggetti JavaScript regolari ed usano classi basate sui prototipi per l'ereditarietà.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Come possiamo notare i nodi DOM sono oggetti JavaScript regolari ed usano classi basate sui prototipi per l'ereditarietà.
Come possiamo notare i nodi DOM sono regolari oggetti JavaScript ed usano classi basate sui prototipi per l'ereditarietà.

Piccolo suggerimento, mi sembra suoni meglio, ma anche la tua versione va benissimo :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sì, effettivamente vanno bene entrambe. Continuo ad avere una leggera preferenza per l'aggettivo dopo: mi sembra che dia più evidenza al termine "regolari"


```smart header="`console.dir(elem)` versus `console.log(elem)`"
Most browsers support two commands in their developer tools: `console.log` and `console.dir`. They output their arguments to the console. For JavaScript objects these commands usually do the same.
La maggior parte dei browser supportano due comandi nei loro strumenti per sviluppatori: `console.log` e `console.dir` che mostrano in console i loro argomenti. Per quanto riguarda gli oggetti JavaScript solitamente questi comandi funzionano allo stesso modo.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
La maggior parte dei browser supportano due comandi nei loro strumenti per sviluppatori: `console.log` e `console.dir` che mostrano in console i loro argomenti. Per quanto riguarda gli oggetti JavaScript solitamente questi comandi funzionano allo stesso modo.
La maggior parte dei browser supportano due comandi nei loro strumenti per sviluppatori: `console.log` e `console.dir` che mostrano in console i loro argomenti. Per quanto riguarda gli oggetti JavaScript, solitamente questi comandi funzionano allo stesso modo.

Copy link
Contributor

@longo-andrea longo-andrea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complimenti, ottima traduzione! 👍 ti ho lasciato un paio di spunti per migliorare la scorrevolezza, sentiti libero di accettarli/rifiutarli/discuterne.

C'è solo una modifica obbligatoria che ti ho segnalato sotto, hai trovato un caso speciale che rompe la renderizzazione della pagina 😆

</script>

</body>
```

```smart header="Scripts don't execute"
If `innerHTML` inserts a `<script>` tag into the document -- it becomes a part of HTML, but doesn't execute.
```smart header="I tag <script> non vengono eseguiti"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complimenti hai beccato un caso particolare finora sconosciuto 😆 Non puoi mettere le parentesi angolari su uno smart header, se vuoi farlo, devi racchiuderli dentro i backtick

Suggested change
```smart header="I tag <script> non vengono eseguiti"
```smart header="I tag `<script>` non vengono eseguiti"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Volevo vedere se eravate attenti 🤣


In the line `(*)` we replaced `div` with `<p>A new element</p>`. In the outer document (the DOM) we can see the new content instead of the `<div>`. But, as we can see in line `(**)`, the value of the old `div` variable hasn't changed!
Nella linea `(*)` sostituiamo `div` con `<p>A new element</p>`. Nel documento (il DOM) possiamo osservare che il nuovo contenuto ha preso il posto di `<div>`. Tuttavia, come possiamo notare nella linea `(**)`, il precedente valore della variabile `div`non è cambiato!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Nella linea `(*)` sostituiamo `div` con `<p>A new element</p>`. Nel documento (il DOM) possiamo osservare che il nuovo contenuto ha preso il posto di `<div>`. Tuttavia, come possiamo notare nella linea `(**)`, il precedente valore della variabile `div`non è cambiato!
Nella linea `(*)` sostituiamo `div` con `<p>A new element</p>`. Nel documento (il DOM) possiamo osservare che il nuovo contenuto ha preso il posto di `<div>`. Tuttavia, come possiamo notare nella linea `(**)`, il precedente valore della variabile `div` non è cambiato!


`nodeName/tagName`
: For elements, tag name (uppercased unless XML-mode). For non-element nodes `nodeName` describes what it is. Read-only.
: Per gli elementi indica il nome del tag (in lettere maiuscole a meno che il browser non sia in modalità XML). Per tutti gli altri nodi `nodeName` contiene una stringa destrittiva. La proprietà è in sola lettura.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
: Per gli elementi indica il nome del tag (in lettere maiuscole a meno che il browser non sia in modalità XML). Per tutti gli altri nodi `nodeName` contiene una stringa destrittiva. La proprietà è in sola lettura.
: Per gli elementi indica il nome del tag (in lettere maiuscole a meno che il browser non sia in modalità XML). Per tutti gli altri nodi `nodeName` contiene una stringa descrittiva. La proprietà è in sola lettura.


Different DOM nodes may have different properties. For instance, an element node corresponding to tag `<a>` has link-related properties, and the one corresponding to `<input>` has input-related properties and so on. Text nodes are not the same as element nodes. But there are also common properties and methods between all of them, because all classes of DOM nodes form a single hierarchy.
Nodi del DOM differenti possono avere proprietà differenti. Ad esempio, un nodo elemento corrispondente ad un tag `<a>` avrà proprietà tipiche dei link ed un nodo corrispondente al tag `<input>` avrà proprietà tipiche dei campi di testo e così via. I nodi di testo sono differenti dai nodi elemento, tuttavia condividono anche proprietà e metodi comuni a tutti perché tutte le classi dei nodi del DOM costituiscono un'unica gerarchia.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Nodi del DOM differenti possono avere proprietà differenti. Ad esempio, un nodo elemento corrispondente ad un tag `<a>` avrà proprietà tipiche dei link ed un nodo corrispondente al tag `<input>` avrà proprietà tipiche dei campi di testo e così via. I nodi di testo sono differenti dai nodi elemento, tuttavia condividono anche proprietà e metodi comuni a tutti perché tutte le classi dei nodi del DOM costituiscono un'unica gerarchia.
Nodi del DOM differenti possono avere proprietà differenti. Ad esempio, un nodo elemento corrispondente ad un tag `<a>` avrà proprietà tipiche dei link ed un nodo corrispondente al tag `<input>` avrà proprietà tipiche dei campi di testo e così via. I nodi di testo sono differenti dai nodi elemento, tuttavia condividono alcune proprietà e metodi comuni a tutti, perché tutte le classi dei nodi del DOM costituiscono un'unica gerarchia.


That's also easy to see by outputting an element with `console.dir(elem)` in a browser. There in the console you can see `HTMLElement.prototype`, `Element.prototype` and so on.
Questo è anche facile da osservare esaminando un elemento in un browser con `console.dir(elem)`. Nella console potremo vedere `HTMLElement.prototype`, `Element.prototype` e così via.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Questo è anche facile da osservare esaminando un elemento in un browser con `console.dir(elem)`. Nella console potremo vedere `HTMLElement.prototype`, `Element.prototype` e così via.
Questo è facilmente osservabile esaminando un elemento in un browser con `console.dir(elem)`. Nella console potremo vedere `HTMLElement.prototype`, `Element.prototype` e così via.


Here's an excerpt from it, with comments:
Eccone un estratto, con commenti:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Eccone un estratto, con commenti:
Eccone un estratto commentato:


We can also modify it. So it's one of the most powerful ways to change the page.
Possiamo anche modificarla e pertanto è uno dei più potenti strumenti per cambiare la pagina.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggerisco una modifica che si discosta leggermente dall'articolo inglese, che mi sembra poco chiaro in questo caso.. infatti quel "change the page", può essere fuorviante

Suggested change
Possiamo anche modificarla e pertanto è uno dei più potenti strumenti per cambiare la pagina.
Possiamo anche modificarla e pertanto è uno dei più potenti strumenti per modificare porzioni della pagina.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A me sembrava chiaro, cambiare un singolo elemento equivale a cambiare la pagina (non necessariamente nella sua interezza), però capisco che possa essere frainteso. Se vogliamo discostarci un po' dall'inglese originario (cosa utile in molti casi), che ne pensi di "modificare l'HTML di un elemento della pagina"? In questo modo ricorriamo ad una perifrasi esplicativa senza allontanarci troppo dal "change the page" originale


The example shows the contents of `document.body` and then replaces it completely:
L'esempio mostra il contenuto di `document.body` e quindi lo rimpiazza completamente:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In questo caso il "then" è inteso come "poi".. infatti guardando l'esempio, fa un alert del body e poi lo rimpiazza

Suggested change
L'esempio mostra il contenuto di `document.body` e quindi lo rimpiazza completamente:
L'esempio mostra il contenuto di `document.body` e successivamente lo rimpiazza completamente:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'accordissimo! Userei "poi lo rimpiazza" perché mi suonano male due avverbi di modo troppo vicini


## Summary
## Sommario
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Summary" lo traduciamo come "Riepilogo", non ricordo se è a Glossario, nel caso ora lo aggiungo

Suggested change
## Sommario
## Riepilogo

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻


In the `chatDiv` example above the line `chatDiv.innerHTML+="How goes?"` re-creates the HTML content and reloads `smile.gif` (hope it's cached). If `chatDiv` has a lot of other text and images, then the reload becomes clearly visible.
Nell'esempio `chatDiv` sopra, la linea `chatDiv.innerHTML+="How goes?"` ricrea il contenuto HTML e ricarica `smile.gif` (speriamo sia in cache). Se `chatDiv` ha molto altro testo e immagini, in quel caso, il tempo di ricaricamento potrebbe diventare chiaramente percepibile.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Nell'esempio `chatDiv` sopra, la linea `chatDiv.innerHTML+="How goes?"` ricrea il contenuto HTML e ricarica `smile.gif` (speriamo sia in cache). Se `chatDiv` ha molto altro testo e immagini, in quel caso, il tempo di ricaricamento potrebbe diventare chiaramente percepibile.
Nell'esempio `chatDiv` sopra, la linea `chatDiv.innerHTML+="How goes?"` ricrea il contenuto HTML e ricarica `smile.gif` (speriamo sia in cache). Se `chatDiv` ha molto altro testo e immagini il tempo di ricaricamento potrebbe diventare chiaramente percepibile.

"in quel caso" e' un po' superfluo e verboso, la frase originale e' piu' intuitiva, si capisce gia' bene qual e' il caso in questione...

Copy link
Contributor

@Dorin-David Dorin-David left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complimenti!

@marcellosurdi
Copy link
Contributor Author

/done

@longo-andrea longo-andrea merged commit 62386bc into javascript-tutorial:master Mar 21, 2021
@javascript-translate-bot

Thank you 💖 I updated the Progress Issue #1 🎉 🎉 🎉

@marcellosurdi marcellosurdi deleted the article/node-properties-type-tag-and-contents branch March 30, 2021 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants