HTMLElement
A interface HTMLElement
representa qualquer elemento HTML. Alguns elementos implementam diretamente essa interface, outros a implementam por meio de uma interface que a herda.
Propriedades
Propriedades herdadas do elemento pai, Element
, e aquelas implementadas de GlobalEventHandlers
e de TouchEventHandlers
.
HTMLElement.accessKey
-
Is a
DOMString
representing the access key assigned to the element. HTMLElement.accessKeyLabel
(en-US) Somente leitura-
Returns a
DOMString
containing the element's assigned access key. HTMLElement.contentEditable
-
Is a
DOMString
, where a value of"true"
means the element is editable and a value of"false"
means it isn't. HTMLElement.isContentEditable
(en-US) Somente leitura-
Returns a
Boolean
(en-US) that indicates whether or not the content of the element can be edited. -
Is an
HTMLMenuElement
(en-US) representing the contextual menu associated with the element. It may be null HTMLElement.dataset
(en-US) Somente leitura-
Returns a
DOMStringMap
that allows access to read and write the element custom data attributes (data-*
) . HTMLElement.dir
(en-US)-
Is a
DOMString
, reflecting thedir
global attribute, representing the directionality of the element. Possible values are"ltr"
,"rtl"
, and"auto"
. HTMLElement.draggable
-
Is a
Boolean
indicating if the element can be dragged. HTMLElement.dropzone
Somente leitura-
Returns a
DOMSettableTokenList
reflecting thedropzone
global attribute and describing the behavior of the element regarding a drop operation. -
Is a
Boolean
indicating if the element is hidden or not. HTMLElement.itemScope
Experimental-
Is a
Boolean
… HTMLElement.itemType
Somente leitura Experimental-
Returns a
DOMSettableTokenList
… HTMLElement.itemId
Experimental-
Is a
DOMString
… HTMLElement.itemRef
Somente leitura Experimental-
Returns a
DOMSettableTokenList
… HTMLElement.itemProp
Somente leitura Experimental-
Returns a
DOMSettableTokenList
… HTMLElement.itemValue
Experimental-
Returns an
Object
… HTMLElement.lang
-
Is a
DOMString
representing the language of an element's attributes, text, and element contents. HTMLElement.offsetHeight
Somente leitura Experimental-
Returns a
double
containing the height of an element, relative to the layout. HTMLElement.offsetLeft
Somente leitura Experimental-
Returns a
double
, the distance from this element's left border to itsoffsetParent
's left border. HTMLElement.offsetParent
Somente leitura Experimental-
Returns an
Element
that is the element from which all offset calculations are currently computed. HTMLElement.offsetTop
Somente leitura Experimental-
Returns a
double
, the distance from this element's top border to itsoffsetParent
's top border. HTMLElement.offsetWidth
Somente leitura Experimental-
Returns a
double
containing the width of an element, relative to the layout. HTMLElement.properties
Somente leitura Experimental-
Returns an
HTMLPropertiesCollection
… HTMLElement.spellcheck
-
Is a
Boolean
that controls spell-checking (en-US). It is present on all HTML elements, though it hasn't an effect on all of them. HTMLElement.style
(en-US)-
Is
CSSStyleDeclaration
(en-US), an object representing the declarations of an element's style attributes. HTMLElement.tabIndex
(en-US)-
Is a
long
representing the position of the element in the tabbing order. HTMLElement.title
(en-US)-
Is a
DOMString
containing the text that appears in a popup box when mouse is over the element. HTMLElement.translate
Experimental-
Is a
Boolean
Event handlers
Most events properties, of the form onXYZ
, are defined on the GlobalEventHandlers
or TouchEventHandlers
, implemented by HTMLElement
. A few more are specific to HTMLElement
.
HTMLElement.oncopy
(en-US) Non-standard-
Returns the event handling code for the
copy
event (bug 280959). HTMLElement.oncut
(en-US) Non-standard-
Returns the event handling code for the
cut
event (bug 280959). HTMLElement.onpaste
(en-US) Non-standard-
Returns the event handling code for the
paste
event (bug 280959). TouchEventHandlers.ontouchstart
Non-standard-
Returns the event handling code for the
touchstart (en-US)
event. TouchEventHandlers.ontouchend
Non-standard-
Returns the event handling code for the
touchend (en-US)
event. TouchEventHandlers.ontouchmove
Non-standard-
Returns the event handling code for the
touchmove (en-US)
event. TouchEventHandlers.ontouchenter
Non-standard-
Returns the event handling code for the
touchenter
event. TouchEventHandlers.ontouchleave
Non-standard-
Returns the event handling code for the
touchleave
event. TouchEventHandlers.ontouchcancel
Non-standard-
Returns the event handling code for the
touchcancel (en-US)
event.
Methods
Inherits methods from its parent, Element
.
HTMLElement.blur()
(en-US)-
Removes keyboard focus from the currently focused element.
HTMLElement.click()
-
Sends a mouse click event to the element.
HTMLElement.focus()
(en-US)-
Makes the element the current keyboard focus.
HTMLElement.forceSpellCheck()
(en-US) Experimental-
Makes the spell checker runs on the element.
Specifications
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) View Module The definition of 'HTMLElement' in that specification. |
Rascunho atual | Added the following properties: offsetParent , offsetTop , offsetLeft , offsetWidth , and offsetHeight . |
HTML Living Standard The definition of 'HTMLElement' in that specification. |
Padrão em tempo real | 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 The definition of 'HTMLElement' in that specification. |
Recomendação | 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 The definition of 'HTMLElement' in that specification. |
Obsoleto | No change from Document Object Model (DOM) Level 2 HTML Specification |
Document Object Model (DOM) Level 1 Specification The definition of 'HTMLElement' in that specification. |
Obsoleto | Initial definition. |
Compatibilidade com navegadores
BCD tables only load in the browser