You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/1-document/05-basic-dom-node-properties/article.md
+22-22Lines changed: 22 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ Le classi sono:
29
29
30
30
In definitiva, la lista completa delle proprietà e dei metodi di un nodo è il risultato dell'ereditarietà.
31
31
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).
33
33
34
34
Esso riceve proprietà e metodi per effetto della sovrapposizione di (elencate in ordine di ereditarietà):
35
35
@@ -41,19 +41,19 @@ Esso riceve proprietà e metodi per effetto della sovrapposizione di (elencate i
41
41
-`EventTarget` -- consente il supporto agli eventi (che tratteremo in seguito),
42
42
- ...e, infine, esso eredita da `Object`, quindi saranno anche disponibili i metodi di un "oggetto semplice" come `hasOwnProperty`.
43
43
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`:
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à.
67
67
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.
69
69
70
70
```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.
72
72
73
-
But for DOM elements they are different:
73
+
Ma per gli elementi DOM sono differenti:
74
74
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à.
77
77
78
-
Try it on`document.body`.
78
+
Provatelo con`document.body`.
79
79
```
80
80
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.
83
83
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.
85
85
86
-
Here's an excerpt from it, with comments:
86
+
Eccone un estratto, con commenti:
87
87
88
88
```js
89
-
// Define HTMLInputElement
89
+
// Definisce HTMLInputElement
90
90
*!*
91
-
// The colon ":" means that HTMLInputElement inherits from HTMLElement
91
+
// I due punti ":" significano che HTMLInputElement eredita da HTMLElement
92
92
*/!*
93
93
interface HTMLInputElement: HTMLElement {
94
-
// here go properties and methods of <input> elements
94
+
// seguono le proprietà ed i metodi degli elementi <input>
95
95
96
96
*!*
97
-
// "DOMString" means that the value of a property is a string
97
+
// "DOMString" significa che il valore di una proprietà è una stringa
98
98
*/!*
99
99
attribute DOMString accept;
100
100
attribute DOMString alt;
101
101
attribute DOMString autocomplete;
102
102
attribute DOMString value;
103
103
104
104
*!*
105
-
// boolean value property (true/false)
105
+
// proprietà con valore booleano (true/false)
106
106
attribute boolean autofocus;
107
107
*/!*
108
108
...
109
109
*!*
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
111
111
*/!*
112
112
void select();
113
113
...
114
114
}
115
115
```
116
116
````
117
117
118
-
## The "nodeType" property
118
+
## La proprietà "nodeType"
119
119
120
120
The `nodeType` property provides one more, "old-fashioned" way to get the "type" of a DOM node.
0 commit comments