Skip to content

Commit 21c26b8

Browse files
committed
Update 2-ui/1-document/05-basic-dom-node-properties/article.md
1 parent 0823b82 commit 21c26b8

File tree

1 file changed

+22
-22
lines changed
  • 2-ui/1-document/05-basic-dom-node-properties

1 file changed

+22
-22
lines changed

2-ui/1-document/05-basic-dom-node-properties/article.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Le classi sono:
2929

3030
In definitiva, la lista completa delle proprietà e dei metodi di un nodo è il risultato dell'ereditarietà.
3131

32-
Si consideri, ad esempio, l'oggetto DOM per un elemento `<input>` che appartiene alla classe [HTMLInputElement](https://html.spec.whatwg.org/multipage/forms.html#htmlinputelement).
32+
Consideriamo, ad esempio, l'oggetto DOM per un elemento `<input>` che appartiene alla classe [HTMLInputElement](https://html.spec.whatwg.org/multipage/forms.html#htmlinputelement).
3333

3434
Esso riceve proprietà e metodi per effetto della sovrapposizione di (elencate in ordine di ereditarietà):
3535

@@ -41,19 +41,19 @@ Esso riceve proprietà e metodi per effetto della sovrapposizione di (elencate i
4141
- `EventTarget` -- consente il supporto agli eventi (che tratteremo in seguito),
4242
- ...e, infine, esso eredita da `Object`, quindi saranno anche disponibili i metodi di un "oggetto semplice" come `hasOwnProperty`.
4343

44-
To see the DOM node class name, we can recall that an object usually has the `constructor` property. It references the class constructor, and `constructor.name` is its name:
44+
Per conoscere il nome della classe di un nodo DOM, ricordiamoci che un oggetto ha solitamente la proprietà `constructor`. Questa si riferisce al costruttore della classe e il suo nome è `constructor.name`:
4545

4646
```js run
4747
alert( document.body.constructor.name ); // HTMLBodyElement
4848
```
4949

50-
...Or we can just `toString` it:
50+
...O possiamo semplicemente eseguire il metodo `toString`:
5151

5252
```js run
5353
alert( document.body ); // [object HTMLBodyElement]
5454
```
5555

56-
We also can use `instanceof` to check the inheritance:
56+
Possiamo inoltre usare `instanceof` per verificare l'ereditarietà:
5757

5858
```js run
5959
alert( document.body instanceof HTMLBodyElement ); // true
@@ -63,59 +63,59 @@ alert( document.body instanceof Node ); // true
6363
alert( document.body instanceof EventTarget ); // true
6464
```
6565

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

68-
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.
68+
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.
6969

7070
```smart header="`console.dir(elem)` versus `console.log(elem)`"
71-
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.
71+
La maggior parte dei browser supportano due comandi nei loro strumenti di sviluppo: `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.
7272

73-
But for DOM elements they are different:
73+
Ma per gli elementi DOM sono differenti:
7474

75-
- `console.log(elem)` shows the element DOM tree.
76-
- `console.dir(elem)` shows the element as a DOM object, good to explore its properties.
75+
- `console.log(elem)` mostra l'alberatura DOM dell'elemento.
76+
- `console.dir(elem)` mostra l'elemento come oggetto DOM, ottimo per esplorarne le proprietà.
7777

78-
Try it on `document.body`.
78+
Provatelo con `document.body`.
7979
```
8080
81-
````smart header="IDL in the spec"
82-
In the specification, DOM classes aren't described by using JavaScript, but a special [Interface description language](https://en.wikipedia.org/wiki/Interface_description_language) (IDL), that is usually easy to understand.
81+
````smart header="L'IDL della specifica"
82+
Nella specifica, le classi DOM non sono descritte con JavaScript, ma con uno speciale [Interface description language](https://en.wikipedia.org/wiki/Interface_description_language) (IDL), che di solito è facile da capire.
8383
84-
In IDL all properties are prepended with their types. For instance, `DOMString`, `boolean` and so on.
84+
Nell'IDL tutte le proprietà sono precedute dai rispettivi tipi. Per esempio `DOMString`, `boolean` e così via.
8585
86-
Here's an excerpt from it, with comments:
86+
Eccone un estratto, con commenti:
8787
8888
```js
89-
// Define HTMLInputElement
89+
// Definisce HTMLInputElement
9090
*!*
91-
// The colon ":" means that HTMLInputElement inherits from HTMLElement
91+
// I due punti ":" significano che HTMLInputElement eredita da HTMLElement
9292
*/!*
9393
interface HTMLInputElement: HTMLElement {
94-
// here go properties and methods of <input> elements
94+
// seguono le proprietà ed i metodi degli elementi <input>
9595
9696
*!*
97-
// "DOMString" means that the value of a property is a string
97+
// "DOMString" significa che il valore di una proprietà è una stringa
9898
*/!*
9999
attribute DOMString accept;
100100
attribute DOMString alt;
101101
attribute DOMString autocomplete;
102102
attribute DOMString value;
103103
104104
*!*
105-
// boolean value property (true/false)
105+
// proprietà con valore booleano (true/false)
106106
attribute boolean autofocus;
107107
*/!*
108108
...
109109
*!*
110-
// now the method: "void" means that the method returns no value
110+
// ora un metodo: "void" significa che il metodo non restituisce alcun valore
111111
*/!*
112112
void select();
113113
...
114114
}
115115
```
116116
````
117117
118-
## The "nodeType" property
118+
## La proprietà "nodeType"
119119
120120
The `nodeType` property provides one more, "old-fashioned" way to get the "type" of a DOM node.
121121

0 commit comments

Comments
 (0)