La interfaz
HTMLElement
representa cualquier elemento HTML. Algunos elementos implementan directamente esta interfaz, otros la implementan a través de una interfaz que hereda de ella.Properties
Hereda propiedades de su padre, Element
, y los implementalo de GlobalEventHandlers
y TouchEventHandlers
.
HTMLElement.accessKey
- Es un
DOMString
que representa la clave de acceso al elemento. HTMLElement.accessKeyLabel
Read only- Devuelve un
DOMString
que contiene la clave asignada del elemento. HTMLElement.contentEditable
- Es un
DOMString
, donde el valor"true"
significa que el elemento es editable y si el valor es"false"
significa que no lo es. HTMLElement.isContentEditable
Read only- Devuelve un
Boolean
si el contenido del elemento puede ser editado. HTMLElement.contextMenu
- Es un
HTMLMenuElement
que representa el menú contextual asociado al elemento. Puede sernull
HTMLElement.dataset
Read only- Devuelve un
DOMStringMap
que permite el acceso de lectura y escritura de los atributos personalizados del elemento (data-*
) . HTMLElement.dir
- Es un
DOMString
, que refleja el atributo globaldir
, representando la direccionalidad del elemento. Los posibles valores son"ltr"
,"rtl"
, and"auto"
. HTMLElement.draggable
- Es un
Boolean
que indica si el elemento puede ser arrastrado.. HTMLElement.dropzone
Read only- Devuelve un
DOMSettableTokenList
que refleja el atributo globaldropzone
y describe el comportamiento del elemento con respecto a una operación de soltar. HTMLElement.hidden
- Es un
Boolean
que indica si el elemento está oculto. HTMLElement.itemScope
- Es un
Boolean
... HTMLElement.itemType
Read only- Devuelve un
DOMSettableTokenList
… HTMLElement.itemId
- Es un
DOMString
… HTMLElement.itemRef
Read only- Devuelve un
DOMSettableTokenList
… HTMLElement.itemProp
Read only- Devuelve un
DOMSettableTokenList
… HTMLElement.itemValue
- Devuelve un
Object
… HTMLElement.lang
- Es un
DOMString
que representa el lenguaje de los atributos del elemento, texto, y contenido del elemento. HTMLElement.offsetHeight
Read only- Devuelve un
double
que contiene la altura de, en relación al diseño (layout)
. HTMLElement.offsetLeft
Read only- Devuelve un
double
, que representa la distancia desde el borde izquierdo del elemento hasta el borde izquierdo del elemento padreoffsetParent
'. HTMLElement.offsetParent
Read only- Returns an
Element
that is the element from which all offset calculations are currently computed. HTMLElement.offsetTop
Read only- Returns a
double
, the distance from this element's top border to itsoffsetParent
's top border. HTMLElement.offsetWidth
Read only- Returns a
double
containing the width of an element, relative to the layout. HTMLElement.properties
Read only- Returns an
HTMLPropertiesCollection
… HTMLElement.spellcheck
- Is a
Boolean
that controls spell-checking. It is present on all HTML elements, though it hasn't an effect on all of them. HTMLElement.style
- Is
CSSStyleDeclaration
, an object representing the declarations of an element's style attributes. HTMLElement.tabIndex
- Is a
long
representing the position of the element in the tabbing order. HTMLElement.title
- Is a
DOMString
containing the text that appears in a popup box when mouse is over the element. HTMLElement.translate
- Is a
Boolean
Event handlers
La mayoria de las propiedades de los eventos, del formulario onXYZ
, estan definidas en las interfaces GlobalEventHandlers
or TouchEventHandlers
, implementadas por HTMLElement
. Otras pocas son especificas de HTMLElement
.
HTMLElement.oncopy
- Returns the event handling code for the
copy
event (error 280959). HTMLElement.oncut
- Returns the event handling code for the
cut
event (error 280959). HTMLElement.onpaste
- Returns the event handling code for the
paste
event (error 280959). TouchEventHandlers.ontouchstart
- Returns the event handling code for the
touchstart
event. TouchEventHandlers.ontouchend
- Returns the event handling code for the
touchend
event. TouchEventHandlers.ontouchmove
- Returns the event handling code for the
touchmove
event. TouchEventHandlers.ontouchenter
- Returns the event handling code for the
touchenter
event. TouchEventHandlers.ontouchleave
- Returns the event handling code for the
touchleave
event. TouchEventHandlers.ontouchcancel
- Returns the event handling code for the
touchcancel
event.
Methods
Inherits methods from its parent, Element
.
HTMLElement.blur()
- Removes keyboard focus from the currently focused element.
HTMLElement.click()
- Sends a mouse click event to the element.
HTMLElement.focus()
- Makes the element the current keyboard focus.
HTMLElement.forceSpellCheck()
- Makes the spell checker runs on the element.
Specifications
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) View Module La definición de 'HTMLElement' en esta especificación. |
Working Draft | Added the following properties: offsetParent , offsetTop , offsetLeft , offsetWidth , and offsetHeight . |
HTML Living Standard La definición de 'HTMLElement' en esta especificación. |
Living Standard | Added the following properties: translate , itemScope , itemType , itemId , itemRef , itemProp , properties , and itemValue .Added the following method: forceSpellcheck() .Moved the onXYZ attributes to the GlobalEventHandlers interface and added an inheritance from it. |
HTML5 La definición de 'HTMLElement' en esta especificación. |
Recommendation | Added the following properties: dataset , hidden , tabindex , accessKey , accessKeyLabel , draggable , dropzone , contentEditable , isContentEditable , contextMenu , spellcheck , commandType , commandLabel , commandIcon , commandHidden , commandDisabled , commandChecked , style , and all the onXYZ properties.Moved the id and className properties to the Element interface. |
Document Object Model (DOM) Level 2 HTML Specification La definición de 'HTMLElement' en esta especificación. |
Obsolete | No change from Document Object Model (DOM) Level 2 HTML Specification |
Document Object Model (DOM) Level 1 Specification La definición de 'HTMLElement' en esta especificación. |
Obsolete | Initial definition. |
Browser compatibility
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!
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 1.0 (1.7 o anterior) | ? | ? | ? | ? |
accessKey |
5.0 (5.0) | 17.0 | ? | ? | (Yes)(535.10) |
accessKeyLabel |
8.0 (8.0) | ? | ? | ? | Sin soporteWebKit 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) | ? | ? | ? | ? |
style |
(Yes) (returns a CSS2Properties , rather than a CSSStyleDeclaration ) |
(Yes) | (Yes) | (Yes) | (Yes) |
forceSpellCheck() |
Sin soporte | Sin soporte | Sin soporte | Sin soporte | Sin soporte |
dataset |
6.0 (6.0) | 8.0 | 11 | 11.10 | 6 |
draggable |
(Yes) | ? | ? | 12.0 | ? |
dropzone |
Sin soporte | Sin soporte | Sin soporte | 12.0 | Sin soporte |
offsetLeft , offsetTop , offsetParent , offsetHeight and offsetWidth |
(Yes) | ? | (Yes) | ? | ? |
translate |
Sin soporte | Sin soporte | Sin soporte | Sin soporte | Sin soporte |
itemScope , itemType , itemRef , itemId , itemProp , and itemValue |
6.0 (6.0) | Sin soporte | Sin soporte | 11.60 (Removed in Opera 15) |
Sin soporte |
properties |
(Yes) | ? | ? | ? | ? |
HTMLElement.ontouchstart , HTMLElement.ontouchend , HTMLElement.ontouchmove , HTMLElement.ontouchenter , HTMLElement.ontouchleave , and HTMLElement.ontouchcancel |
(Yes) | (Yes) | Sin soporte | ? | (Yes) |
HTMLElement.oncopy , HTMLElement.oncut , and HTMLElement.onpaste |
3.0 (1.9) | ? | ? | ? | ? |
Feature | Firefox Mobile (Gecko) | Android | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support |
1.0 (1.0) |
? | ? | ? | ? |
accessKey |
5.0 (5.0) | ||||
accessKeyLabel |
8.0 (8.0) | ||||
blur() |
5.0 (5.0) | ||||
click() |
5.0 (5.0) | ||||
dataset |
6.0 (6.0) | ||||
focus() |
5.0 (5.0) | ||||
HTMLElement.oncopy , HTMLElement.oncut , and HTMLElement.onpaste |
1.0 (1.9) | ? | ? | ? | ? |