L'interfaccia HTMLElement
rappresenta un qualsiasi elemento HTML. Alcuni elementi implementano direttamente questa interfaccia, altri la implementano attraverso un'interfaccia che la eredita.
Proprietà
Eredita le proprietà dai propri genitori, da Element
e da GlobalEventHandlers
.
Nome | Tipo | Descrizione |
---|---|---|
HTMLElement.accessKey |
DOMString |
La chiave d'accesso assegnata all'elemento. |
HTMLElement.accessKeyLabel |
DOMString |
Una stringa che rappresenta la chiave d'accesso assegnata all'elemento. |
HTMLElement.contentEditable |
DOMString |
Ritorna o assegna la modificabilità dell'elemento. |
HTMLElement.isContentEditable Read only |
Boolean |
Indica se il contenuto dell'elemento sia modificabile. |
HTMLElement.dataset Read only |
DOMStringMap |
Permette di leggere e scrivere attributi personalizzati (data-* ) nell'elemento. |
HTMLElement.dir |
DOMString |
Ritorna o assegna la direzione dell'elemento |
HTMLElement.draggable |
Boolean |
|
HTMLElement.dropzone Read only |
DOMSettableTokenList |
|
HTMLElement.hidden |
Boolean |
|
HTMLElement.itemScope |
Boolean |
|
HTMLElement.itemType Read only |
DOMSettableTokenList |
|
HTMLElement.itemId |
DOMString |
|
HTMLElement.itemRef Read only |
DOMSettableTokenList |
|
HTMLElement.itemProp Read only |
DOMSettableTokenList |
|
HTMLElement.itemValue |
any |
|
HTMLElement.lang |
DOMString |
Ritorna o assegna la lingua di un attributo, di un elemento, del testo e del contenuto di un elemento. |
HTMLElement.offsetHeight Read only |
double |
L'altezza di un elemento, relativa al layout. |
HTMLElement.offsetLeft Read only |
double |
La distanza tra il bordo sinistro dell'elemento e il bordo sinistro del suo offsetParent . |
HTMLElement.offsetParent Read only |
Element |
L'elemento a partire dal quale tutti i calcoli dell'offset sono effettuati. |
HTMLElement.offsetTop Read only |
double |
La distanza tra il bordo superiore dell'elemento e il bordo superiore del suo offsetParent . |
HTMLElement.offsetWidth Read only |
double |
La larghezza di un elemento, relativa al layout. |
HTMLElement.properties Read only |
HTMLPropertiesCollection |
|
HTMLElement.spellcheck |
Boolean |
Controlla il controllo ortografico (presente in tutti gli elementi HTML) |
HTMLElement.style |
CSSStyleDeclaration |
Un oggetto che rappresenta la dichiarazione degli attributi di stile di un elemento. |
HTMLElement.tabIndex |
long |
Ritorna o assegna la posizione di un elemento nell'ordine di tabbing. |
HTMLElement.title |
DOMString |
Una stringa che appare in un popup quando il mouse si trova sopra all'elemento. |
HTMLElement.translate |
Boolean |
Gestori degli eventi
Le proprietà degli eventi, nella forma onXYZ
, sono definite nei GlobalEventHandlers
implementati da HTMLElement
. Alcune altre sono specifiche per HTMLElement
.
HTMLElement.onTouchStart
- Restituisce il codice di gestione dell'evento
touchstart
. HTMLElement.onTouchEnd
- Restituisce il codice di gestione dell'evento
touchend
. HTMLElement.onTouchMove
- Restituisce il codice di gestione dell'evento
touchmove
. HTMLElement.onTouchEnter
- Restituisce il codice di gestione dell'evento
touchenter
. HTMLElement.onTouchLeave
- Restituisce il codice di gestione dell'evento
touchleave
. HTMLElement.onTouchCancel
- Restituisce il codice di gestione dell'evento
touchcancel
.
Metodi
Eredita i metodi dal genitore, Element
.
Nome e argomenti | Restituisce | Descrizione |
---|---|---|
HTMLElement.blur() |
void |
Rimuove il focus della tastiera dall'elemento attualmente in focus. |
HTMLElement.click() |
void |
Invia un evento di clic del mouse all'elemento. |
HTMLElement.focus() |
void |
Porta il focus della tastiera sull'elemento. |
HTMLElement.forceSpellCheck() |
void |
Specifiche
Specifica | Stato | Commenti |
---|---|---|
CSS Object Model (CSSOM) View Module The definition of 'HTMLElement' in that specification. |
Working Draft | Aggiunge le seguenti proprietà: offsetParent , offsetTop , offsetLeft , offsetWidth , e offsetHeight . |
HTML Living Standard The definition of 'HTMLElement' in that specification. |
Living Standard | Aggiunge le seguenti proprietà: translate , itemScope , itemType , itemId , itemRef , itemProp , properties , e itemValue .Aggiunti i seguenti metodi: forceSpellcheck() .Spostati gli attributi onXYZ all'interfaccia GlobalEventHandlers e aggiunta la sua ereditarietà. |
HTML5 The definition of 'HTMLElement' in that specification. |
Recommendation | Aggiunge le seguenti proprietà: dataset , hidden , tabindex , accessKey , accessKeyLabel , draggable , dropzone , contentEditable , isContentEditable , contextMenu , spellcheck , commandType , commandLabel , commandIcon , commandHidden , commandDisabled , commandChecked , style , e tutte le proprietà onXYZ .Spostate le proprietà id e className all'interfaccia Element . |
Document Object Model (DOM) Level 2 HTML Specification The definition of 'HTMLElement' in that specification. |
Obsolete | Nessun cambiamento da Document Object Model (DOM) Level 2 HTML Specification |
Document Object Model (DOM) Level 1 Specification The definition of 'HTMLElement' in that specification. |
Obsolete | Definizione iniziale. |
Compatibilità con i browser
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Funzionalità | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Supporto di base | 1.0 (1.7 or earlier) | ? | ? | ? | ? |
accessKey |
5.0 (5.0) | 17.0 | ? | ? | (Yes)(535.10) |
accessKeyLabel |
8.0 (8.0) | ? | ? | ? | No supportWebKit bug 72715 |
blur() |
5.0 (5.0) | ? | ? | ? | ? |
click() |
5.0 (5.0) | ? | ? | ? | (Yes)(535.24) |
dataset |
6.0 (6.0) | 9.0 | ? | 11.10 | 5.1 |
focus() |
5.0 (5.0) | ? | ? | ? | ? |
contentEditable |
3.0 (1.9) | (Yes) | 5.5 | 9 | (Yes) |
spellcheck |
2.0 (1.8.1) | ? | ? | ? | ? |
forceSpellCheck() |
No support | No support | No support | No support | No support |
dataset |
6.0 (6.0) | 8.0 | 11 | 11.10 | 6 |
draggable |
(Yes) | ? | ? | 12.0 | ? |
dropzone |
No support | No support | No support | 12.0 | No support |
offsetLeft , offsetTop , offsetParent , offsetHeight and offsetWidth |
(Yes) | ? | (Yes) | ? | ? |
translate |
No support | No support | No support | No support | No support |
itemScope , itemType , itemRef , itemId , itemProp , and itemValue |
6.0 (6.0) | No support | No support | 11.60 (Removed in Opera 15) |
No support |
properties |
(Yes) | ? | ? | ? | ? |
HTMLElement.ontouchstart , HTMLElement.ontouchend , HTMLElement.ontouchmove , HTMLElement.ontouchenter , HTMLElement.ontouchleave , and HTMLElement.ontouchcancel |
(Yes) | (Yes) | No support | ? | (Yes) |