Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1115127 of HTMLElement

  • Revision slug: Web/API/HTMLElement
  • Revision title: HTMLElement
  • Revision id: 1115127
  • Created:
  • Creator: slimsag
  • Is current revision? No
  • Comment

Revision Content

{{ APIRef("HTML DOM") }}
 

The HTMLElement interface represents any HTML element. Some elements directly implement this interface, others implement it via an interface that inherits it.

Properties

Inherits properties from its parent, {{domxref("Element")}}, and implements those from {{domxref("GlobalEventHandlers")}} and {{domxref("TouchEventHandlers")}}.

{{domxref("HTMLElement.accessKey")}}
Is a {{domxref("DOMString")}} representing the access key assigned to the element.
{{domxref("HTMLElement.accessKeyLabel")}} {{readonlyInline}}
Returns a {{domxref("DOMString")}} containing the element's assigned access key.
{{domxref("HTMLElement.contentEditable")}}
Is a {{domxref("DOMString")}}, where a value of "true" means the element is editable and a value of "false" means it isn't.
{{domxref("HTMLElement.isContentEditable")}} {{readonlyInline}}
Returns a {{domxref("Boolean")}} that indicates whether or not the content of the element can be edited.
{{domxref("HTMLElement.contextMenu")}}
Is a {{domxref("HTMLMenuElement")}} representing the contextual menu associated with the element. It may be null
{{domxref("HTMLElement.dataset")}} {{readonlyInline}}
Returns a {{domxref("DOMStringMap")}} that allows access to read and write the element custom data attributes (data-*) .
{{domxref("HTMLElement.dir")}}
Is a {{domxref("DOMString")}}, reflecting the dir global attribute, representing the directionality of the element. Possible values are "ltr", "rtl", and "auto".
{{domxref("HTMLElement.draggable")}}
Is a {{jsxref("Boolean")}} indicating if the element can be dragged.
{{domxref("HTMLElement.dropzone")}} {{readonlyInline}}
Returns a {{domxref("DOMSettableTokenList")}} reflecting the dropzone global attribute and describing the behavior of the element regarding a drop operation.
{{domxref("HTMLElement.hidden")}}
Is a {{jsxref("Boolean")}} indicating if the element is hidden or not.
{{domxref("HTMLElement.itemScope")}} {{experimental_inline}}
Is a {{jsxref("Boolean")}} representing the item scope.
{{domxref("HTMLElement.itemType")}} {{readonlyInline}}{{experimental_inline}}
Returns a {{domxref("DOMSettableTokenList")}}…
{{domxref("HTMLElement.itemId")}} {{experimental_inline}}
Is a {{domxref("DOMString")}} representing the item ID.
{{domxref("HTMLElement.itemRef")}} {{readonlyInline}}{{experimental_inline}}
Returns a {{domxref("DOMSettableTokenList")}}…
{{domxref("HTMLElement.itemProp")}} {{readonlyInline}}{{experimental_inline}}
Returns a {{domxref("DOMSettableTokenList")}}…
{{domxref("HTMLElement.itemValue")}} {{experimental_inline}}
Returns an {{jsxref("Object")}} representing the item value.
{{domxref("HTMLElement.lang")}}
Is a {{domxref("DOMString")}} representing the language of an element's attributes, text, and element contents.
{{domxref("HTMLElement.offsetHeight")}} {{readonlyInline}}{{experimental_inline}}
Returns a double containing the height of an element, relative to the layout.
{{domxref("HTMLElement.offsetLeft")}}{{readonlyInline}}{{experimental_inline}}
Returns a double, the distance from this element's left border to its offsetParent's left border.
{{domxref("HTMLElement.offsetParent")}}{{readonlyInline}}{{experimental_inline}}
Returns an {{domxref("Element")}} that is the element from which all offset calculations are currently computed.
{{domxref("HTMLElement.offsetTop")}}{{readonlyInline}}{{experimental_inline}}
Returns a double, the distance from this element's top border to its offsetParent's top border.
{{domxref("HTMLElement.offsetWidth")}}{{readonlyInline}}{{experimental_inline}}
Returns a double containing the width of an element, relative to the layout.
{{domxref("HTMLElement.properties")}} {{readonlyInline}}{{experimental_inline}}
Returns an {{domxref("HTMLPropertiesCollection")}}…
{{domxref("HTMLElement.spellcheck")}}{{ gecko_minversion_inline("1.9")}}
Is a {{jsxref("Boolean")}} that controls spell-checking. It is present on all HTML elements, though it doesn't have an effect on all of them.
{{domxref("HTMLElement.style")}}
Is {{domxref("CSSStyleDeclaration")}}, an object representing the declarations of an element's style attributes.
{{domxref("HTMLElement.tabIndex")}}
Is a long representing the position of the element in the tabbing order.
{{domxref("HTMLElement.title")}}
Is a {{domxref("DOMString")}} containing the text that appears in a popup box when mouse is over the element.
{{domxref("HTMLElement.translate")}} {{experimental_inline}}
Is a {{jsxref("Boolean")}} representing the translation.

Event handlers

Most events properties, of the form onXYZ, are defined on the {{domxref("GlobalEventHandlers")}} or {{domxref("TouchEventHandlers")}}, implemented by HTMLElement. A few more are specific to HTMLElement.

{{ domxref("HTMLElement.oncopy") }}  {{ non-standard_inline() }}
Returns the event handling code for the copy event ({{bug("280959")}}).
{{ domxref("HTMLElement.oncut") }}  {{ non-standard_inline() }}
Returns the event handling code for the cut event ({{bug("280959")}}).
{{ domxref("HTMLElement.onpaste") }} {{ non-standard_inline() }}
Returns the event handling code for the paste event ({{bug("280959")}}).
{{domxref("TouchEventHandlers.ontouchstart")}} {{non-standard_inline}}
Returns the event handling code for the {{event("touchstart")}} event.
{{domxref("TouchEventHandlers.ontouchend")}} {{non-standard_inline}}
Returns the event handling code for the {{event("touchend")}} event.
{{domxref("TouchEventHandlers.ontouchmove")}} {{non-standard_inline}}
Returns the event handling code for the {{event("touchmove")}} event.
{{domxref("TouchEventHandlers.ontouchenter")}} {{non-standard_inline}}
Returns the event handling code for the {{event("touchenter")}} event.
{{domxref("TouchEventHandlers.ontouchleave")}} {{non-standard_inline}}
Returns the event handling code for the {{event("touchleave")}} event.
{{domxref("TouchEventHandlers.ontouchcancel")}} {{non-standard_inline}}
Returns the event handling code for the {{event("touchcancel")}} event.

Methods

Inherits methods from its parent, {{domxref("Element")}}.

{{domxref("HTMLElement.blur()")}}
Removes keyboard focus from the currently focused element.
{{domxref("HTMLElement.click()")}}
Sends a mouse click event to the element.
{{domxref("HTMLElement.focus()")}}
Makes the element the current keyboard focus.
{{domxref("HTMLElement.forceSpellCheck()")}} {{experimental_inline}}
Makes the spell checker runs on the element.

Specifications

Specification Status Comment
{{SpecName('CSSOM View', '#extensions-to-the-htmlelement-interface', 'HTMLElement')}} {{Spec2('CSSOM View')}} Added the following properties: offsetParent, offsetTop, offsetLeft, offsetWidth, and offsetHeight.
{{SpecName('HTML WHATWG', 'elements.html#htmlelement', 'HTMLElement')}} {{Spec2('HTML WHATWG')}} Added the following properties: translate, itemScope, itemType, itemId, itemRef, itemProp, properties, and itemValue.
Added the following method: forceSpellcheck().
Moved the onXYZ attributes to the {{domxref("GlobalEventHandlers")}} interface and added an inheritance from it.
{{SpecName('HTML5 W3C', 'dom.html#htmlelement', 'HTMLElement')}} {{Spec2('HTML5 W3C')}} 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 {{domxref("Element")}} interface.
{{SpecName('DOM2 HTML', 'html.html#ID-011100101', 'HTMLElement')}} {{Spec2('DOM2 HTML')}} No change from {{SpecName('DOM2 HTML')}}
{{SpecName('DOM1', 'level-one-html.html#ID-011100101', 'HTMLElement')}} {{Spec2('DOM1')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support {{CompatGeckoDesktop("1.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
{{domxref("HTMLElement.accessKey", "accessKey")}} {{CompatGeckoDesktop("5.0")}} 17.0 {{CompatUnknown}} {{CompatUnknown}} 6.0
{{domxref("HTMLElement.accessKeyLabel", "accessKeyLabel")}} {{CompatGeckoDesktop("8.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatNo}}{{WebkitBug(72715)}}
{{domxref("HTMLElement.blur()", "blur()")}} {{CompatGeckoDesktop("5.0")}} {{CompatUnknown}} 9 {{CompatUnknown}} {{CompatUnknown}}
{{domxref("HTMLElement.click()", "click()")}} {{CompatGeckoDesktop("5.0")}} {{CompatUnknown}}9 9 {{CompatUnknown}} 6.0
{{domxref("HTMLElement.dataset", "dataset")}} {{CompatGeckoDesktop("6.0")}} 8 11 11.10 5.1
{{domxref("HTMLElement.focus()", "focus()")}} {{CompatGeckoDesktop("5.0")}} {{CompatUnknown}} 9 {{CompatUnknown}} {{CompatUnknown}}
{{domxref("HTMLElement.contentEditable", "contentEditable")}} {{CompatGeckoDesktop("1.9")}} {{CompatVersionUnknown}} 5.5 9 {{CompatVersionUnknown}}
{{domxref("HTMLElement.spellcheck", "spellcheck")}} {{CompatGeckoDesktop("1.8.1")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
{{domxref("HTMLElement.style", "style")}} {{CompatVersionUnknown}} (returns a {{domxref("CSS2Properties")}}, rather than a {{domxref("CSSStyleDeclaration")}}) {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
{{domxref("HTMLElement.forceSpellCheck", "forceSpellCheck()")}} {{experimental_inline}} {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
{{domxref("HTMLElement.draggable", "draggable")}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatUnknown}} 12.0 {{CompatUnknown}}
{{domxref("HTMLElement.dropzone", "dropzone")}} {{CompatNo}} {{CompatNo}} {{CompatNo}} 12.0 {{CompatNo}}
{{domxref("HTMLElement.offsetLeft", "offsetLeft")}}, {{domxref("HTMLElement.offsetTop", "offsetTop")}}, {{domxref("HTMLElement.offsetParent", "offsetParent")}}, {{domxref("HTMLElement.offsetHeight", "offsetHeight")}} and {{domxref("HTMLElement.offsetWidth", "offsetWidth")}} {{experimental_inline}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatUnknown}}
{{domxref("HTMLElement.translate", "translate")}} {{experimental_inline}} {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
{{domxref("HTMLElement.itemScope", "itemScope")}}, {{domxref("HTMLElement.itemType", "itemType")}}, {{domxref("HTMLElement.itemRef", "itemRef")}}, {{domxref("HTMLElement.itemId", "itemId")}}, {{domxref("HTMLElement.itemProp", "itemProp")}}, and {{domxref("HTMLElement.itemValue", "itemValue")}} {{experimental_inline}} {{CompatGeckoDesktop("6.0")}} {{CompatNo}} {{CompatNo}} 11.60
(Removed in Opera 15)
{{CompatNo}}
{{domxref("HTMLElement.properties", "properties")}} {{experimental_inline}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
{{domxref("HTMLElement.ontouchstart")}}, {{domxref("HTMLElement.ontouchend")}}, {{domxref("HTMLElement.ontouchmove")}}, {{domxref("HTMLElement.ontouchenter")}}, {{domxref("HTMLElement.ontouchleave")}}, and {{domxref("HTMLElement.ontouchcancel")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatNo}} {{CompatUnknown}} {{CompatVersionUnknown}}
{{domxref("HTMLElement.oncopy")}}, {{domxref("HTMLElement.oncut")}}, and {{domxref("HTMLElement.onpaste")}} {{Non-standard_inline}} {{CompatGeckoDesktop("1.9")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Firefox Mobile (Gecko) Android IE Mobile Opera Mobile Safari Mobile
Basic support

{{CompatGeckoMobile("1.0")}}

{{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
{{domxref("HTMLElement.accessKey", "accessKey")}} {{CompatGeckoMobile("5.0")}}
{{domxref("HTMLElement.accessKeyLabel", "accessKeyLabel")}} {{CompatGeckoMobile("8.0")}}
{{domxref("HTMLElement.blur()", "blur()")}} {{CompatGeckoMobile("5.0")}}
{{domxref("HTMLElement.click()", "click()")}} {{CompatGeckoMobile("5.0")}}
{{domxref("HTMLElement.dataset", "dataset")}} {{CompatGeckoMobile("6.0")}}
{{domxref("HTMLElement.focus()", "focus()")}} {{CompatGeckoMobile("5.0")}}
{{domxref("HTMLElement.oncopy")}}, {{domxref("HTMLElement.oncut")}}, and {{domxref("HTMLElement.onpaste")}} {{Non-standard_inline}} {{CompatGeckoMobile("1.9")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

See also

  • {{domxref("Element")}}

Revision Source

<div>
<div>{{ APIRef("HTML DOM") }}</div>
</div>

<div>&nbsp;</div>

<p>The <strong><code>HTMLElement</code></strong> interface represents any <a href="/en-US/docs/Web/HTML" title="/en-US/docs/Web/HTML">HTML</a> element. Some elements directly implement this interface, others implement it via an interface that inherits it.</p>

<h2 id="Properties">Properties</h2>

<p><em>Inherits properties from its parent, {{domxref("Element")}}, and implements those from {{domxref("GlobalEventHandlers")}} and {{domxref("TouchEventHandlers")}}.</em></p>

<dl>
 <dt>{{domxref("HTMLElement.accessKey")}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing the access key assigned to the element.</dd>
 <dt>{{domxref("HTMLElement.accessKeyLabel")}} {{readonlyInline}}</dt>
 <dd>Returns a {{domxref("DOMString")}} containing the element's assigned access key.</dd>
 <dt>{{domxref("HTMLElement.contentEditable")}}</dt>
 <dd>Is a {{domxref("DOMString")}}, where a value of <code>"true"</code> means the element is editable and a value of <code>"false"</code> means it isn't.</dd>
 <dt>{{domxref("HTMLElement.isContentEditable")}} {{readonlyInline}}</dt>
 <dd>Returns a {{domxref("Boolean")}} that indicates whether or not the content of the element can be edited.</dd>
 <dt>{{domxref("HTMLElement.contextMenu")}}</dt>
 <dd>Is a {{domxref("HTMLMenuElement")}} representing the contextual menu associated with the element. It may be null</dd>
 <dt>{{domxref("HTMLElement.dataset")}} {{readonlyInline}}</dt>
 <dd>Returns a {{domxref("DOMStringMap")}} that allows access to read and write the element custom data attributes (<code>data-*</code>) .</dd>
 <dt>{{domxref("HTMLElement.dir")}}</dt>
 <dd>Is a {{domxref("DOMString")}}, reflecting the <code>dir</code> global attribute, representing the directionality of the element. Possible values are <code>"ltr"</code>, <code>"rtl"</code>, and <code>"auto"</code>.</dd>
 <dt>{{domxref("HTMLElement.draggable")}}</dt>
 <dd>Is a {{jsxref("Boolean")}} indicating if the element can be dragged.</dd>
 <dt>{{domxref("HTMLElement.dropzone")}} {{readonlyInline}}</dt>
 <dd>Returns a {{domxref("DOMSettableTokenList")}} reflecting the <code>dropzone</code> global attribute and describing the behavior of the element regarding a drop operation.</dd>
 <dt>{{domxref("HTMLElement.hidden")}}</dt>
 <dd>Is a {{jsxref("Boolean")}} indicating if the element is hidden or not.</dd>
 <dt>{{domxref("HTMLElement.itemScope")}} {{experimental_inline}}</dt>
 <dd>Is a {{jsxref("Boolean")}} representing the item scope.</dd>
 <dt>{{domxref("HTMLElement.itemType")}} {{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns a {{domxref("DOMSettableTokenList")}}…</dd>
 <dt>{{domxref("HTMLElement.itemId")}} {{experimental_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing the item ID.</dd>
 <dt>{{domxref("HTMLElement.itemRef")}} {{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns a {{domxref("DOMSettableTokenList")}}…</dd>
 <dt>{{domxref("HTMLElement.itemProp")}} {{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns a {{domxref("DOMSettableTokenList")}}…</dd>
 <dt>{{domxref("HTMLElement.itemValue")}} {{experimental_inline}}</dt>
 <dd>Returns an {{jsxref("Object")}} representing the item value.</dd>
 <dt>{{domxref("HTMLElement.lang")}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing the language of an element's attributes, text, and element contents.</dd>
 <dt>{{domxref("HTMLElement.offsetHeight")}} {{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns a <code>double</code> containing the height of an element, relative to the layout.</dd>
 <dt>{{domxref("HTMLElement.offsetLeft")}}{{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns a <code>double</code>, the distance from this element's left border to its <code>offsetParent</code>'s left border.</dd>
 <dt>{{domxref("HTMLElement.offsetParent")}}{{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns an {{domxref("Element")}} that is the element from which all offset calculations are currently computed.</dd>
 <dt>{{domxref("HTMLElement.offsetTop")}}{{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns a <code>double</code>, the distance from this element's top border to its <code>offsetParent</code>'s top border.</dd>
 <dt>{{domxref("HTMLElement.offsetWidth")}}{{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns a <code>double</code> containing the width of an element, relative to the layout.</dd>
 <dt>{{domxref("HTMLElement.properties")}} {{readonlyInline}}{{experimental_inline}}</dt>
 <dd>Returns an {{domxref("HTMLPropertiesCollection")}}…</dd>
 <dt>{{domxref("HTMLElement.spellcheck")}}{{ gecko_minversion_inline("1.9")}}</dt>
 <dd>Is a {{jsxref("Boolean")}} that controls <a href="/en-US/docs/HTML/Controlling_spell_checking_in_HTML_forms" title="en/Controlling_spell_checking_in_HTML_forms">spell-checking</a>. It is present on all HTML&nbsp;elements, though it doesn't have an effect on all of them.</dd>
 <dt>{{domxref("HTMLElement.style")}}</dt>
 <dd>Is {{domxref("CSSStyleDeclaration")}}, an object representing the declarations of an element's style attributes.</dd>
 <dt>{{domxref("HTMLElement.tabIndex")}}</dt>
 <dd>Is a <code>long</code> representing the position of the element in the tabbing order.</dd>
 <dt>{{domxref("HTMLElement.title")}}</dt>
 <dd>Is a {{domxref("DOMString")}} containing the text that appears in a popup box when mouse is over the element.</dd>
 <dt>{{domxref("HTMLElement.translate")}} {{experimental_inline}}</dt>
 <dd>Is a {{jsxref("Boolean")}} representing the translation.</dd>
</dl>

<h3 id="Event_handlers">Event handlers</h3>

<p>Most events properties, of the form <code>onXYZ</code>, are defined on the {{domxref("GlobalEventHandlers")}} or {{domxref("TouchEventHandlers")}}, implemented by <code>HTMLElement</code>. A few more are specific to <code>HTMLElement</code>.</p>

<dl>
 <dt>{{ domxref("HTMLElement.oncopy") }}&nbsp; {{ non-standard_inline() }}</dt>
 <dd>Returns the event handling code for the <code>copy</code> event ({{bug("280959")}}).</dd>
 <dt>{{ domxref("HTMLElement.oncut") }}&nbsp; {{ non-standard_inline() }}</dt>
 <dd>Returns the event handling code for the <code>cut</code> event ({{bug("280959")}}).</dd>
 <dt>{{ domxref("HTMLElement.onpaste") }} {{ non-standard_inline() }}</dt>
 <dd>Returns the event handling code for the <code>paste</code> event ({{bug("280959")}}).</dd>
 <dt>{{domxref("TouchEventHandlers.ontouchstart")}} {{non-standard_inline}}</dt>
 <dd>Returns the event handling code for the {{event("touchstart")}} event.</dd>
 <dt>{{domxref("TouchEventHandlers.ontouchend")}} {{non-standard_inline}}</dt>
 <dd>Returns the event handling code for the {{event("touchend")}} event.</dd>
 <dt>{{domxref("TouchEventHandlers.ontouchmove")}} {{non-standard_inline}}</dt>
 <dd>Returns the event handling code for the {{event("touchmove")}} event.</dd>
 <dt>{{domxref("TouchEventHandlers.ontouchenter")}} {{non-standard_inline}}</dt>
 <dd>Returns the event handling code for the {{event("touchenter")}} event.</dd>
 <dt>{{domxref("TouchEventHandlers.ontouchleave")}} {{non-standard_inline}}</dt>
 <dd>Returns the event handling code for the {{event("touchleave")}} event.</dd>
 <dt>{{domxref("TouchEventHandlers.ontouchcancel")}} {{non-standard_inline}}</dt>
 <dd>Returns the event handling code for the {{event("touchcancel")}} event.</dd>
</dl>

<h2 id="Methods">Methods</h2>

<p><em>Inherits methods from its parent, {{domxref("Element")}}.</em></p>

<dl>
 <dt>{{domxref("HTMLElement.blur()")}}</dt>
 <dd>Removes keyboard focus from the currently focused element.</dd>
 <dt>{{domxref("HTMLElement.click()")}}</dt>
 <dd>Sends a mouse click event to the element.</dd>
 <dt>{{domxref("HTMLElement.focus()")}}</dt>
 <dd>Makes the element the current keyboard focus.</dd>
 <dt>{{domxref("HTMLElement.forceSpellCheck()")}} {{experimental_inline}}</dt>
 <dd>Makes the spell checker runs on the element.</dd>
</dl>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSSOM View', '#extensions-to-the-htmlelement-interface', 'HTMLElement')}}</td>
   <td>{{Spec2('CSSOM View')}}</td>
   <td>Added the following properties: <code>offsetParent</code>, <code>offsetTop</code>, <code>offsetLeft</code>, <code>offsetWidth</code>, and <code>offsetHeight</code>.</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'elements.html#htmlelement', 'HTMLElement')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>Added the following properties: <code>translate</code>, <code>itemScope</code>, <code>itemType</code>, <code>itemId</code>, <code>itemRef</code>, <code>itemProp</code>, <code>properties</code>, and <code>itemValue</code>.<br />
    Added the following method: <code>forceSpellcheck()</code>.<br />
    Moved the <code>onXYZ</code> attributes to the {{domxref("GlobalEventHandlers")}} interface and added an inheritance from it.</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'dom.html#htmlelement', 'HTMLElement')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>Added the following properties: <code>dataset</code>, <code>hidden</code>, <code>tabindex</code>, <code>accessKey</code>, <code>accessKeyLabel</code>, <code>draggable</code>, <code>dropzone</code>, <code>contentEditable</code>, <code>isContentEditable</code>, <code>contextMenu</code>, <code>spellcheck</code>, <code>commandType</code>, <code>commandLabel</code>, <code>commandIcon</code>, <code>commandHidden</code>, <code>commandDisabled</code>, <code>commandChecked</code>, <code>style</code>, and all the <code>onXYZ</code> properties.<br />
    Moved the <code>id</code> and <code>className</code> properties to the {{domxref("Element")}} interface.</td>
  </tr>
  <tr>
   <td>{{SpecName('DOM2 HTML', 'html.html#ID-011100101', 'HTMLElement')}}</td>
   <td>{{Spec2('DOM2 HTML')}}</td>
   <td>No change from {{SpecName('DOM2 HTML')}}</td>
  </tr>
  <tr>
   <td>{{SpecName('DOM1', 'level-one-html.html#ID-011100101', 'HTMLElement')}}</td>
   <td>{{Spec2('DOM1')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Firefox (Gecko)</th>
   <th>Chrome</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatGeckoDesktop("1.0")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.accessKey", "accessKey")}}</td>
   <td>{{CompatGeckoDesktop("5.0")}}</td>
   <td>17.0</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>6.0</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.accessKeyLabel", "accessKeyLabel")}}</td>
   <td>{{CompatGeckoDesktop("8.0")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}{{WebkitBug(72715)}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.blur()", "blur()")}}</td>
   <td>{{CompatGeckoDesktop("5.0")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>9</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.click()", "click()")}}</td>
   <td>{{CompatGeckoDesktop("5.0")}}</td>
   <td>{{CompatUnknown}}9</td>
   <td>9</td>
   <td>{{CompatUnknown}}</td>
   <td>6.0</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.dataset", "dataset")}}</td>
   <td>{{CompatGeckoDesktop("6.0")}}</td>
   <td>8</td>
   <td>11</td>
   <td>11.10</td>
   <td>5.1</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.focus()", "focus()")}}</td>
   <td>{{CompatGeckoDesktop("5.0")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>9</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.contentEditable", "contentEditable")}}</td>
   <td>{{CompatGeckoDesktop("1.9")}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>5.5</td>
   <td>9</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.spellcheck", "spellcheck")}}</td>
   <td>{{CompatGeckoDesktop("1.8.1")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.style", "style")}}</td>
   <td>{{CompatVersionUnknown}} (returns a {{domxref("CSS2Properties")}}, rather than a&nbsp;{{domxref("CSSStyleDeclaration")}})</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.forceSpellCheck", "forceSpellCheck()")}} {{experimental_inline}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.draggable", "draggable")}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>12.0</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.dropzone", "dropzone")}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>12.0</td>
   <td>{{CompatNo}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.offsetLeft", "offsetLeft")}}, {{domxref("HTMLElement.offsetTop", "offsetTop")}}, {{domxref("HTMLElement.offsetParent", "offsetParent")}}, {{domxref("HTMLElement.offsetHeight", "offsetHeight")}} and {{domxref("HTMLElement.offsetWidth", "offsetWidth")}} {{experimental_inline}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.translate", "translate")}} {{experimental_inline}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.itemScope", "itemScope")}}, {{domxref("HTMLElement.itemType", "itemType")}}, {{domxref("HTMLElement.itemRef", "itemRef")}}, {{domxref("HTMLElement.itemId", "itemId")}}, {{domxref("HTMLElement.itemProp", "itemProp")}}, and {{domxref("HTMLElement.itemValue", "itemValue")}} {{experimental_inline}}</td>
   <td>{{CompatGeckoDesktop("6.0")}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>11.60<br />
    (Removed in Opera 15)</td>
   <td>{{CompatNo}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.properties", "properties")}} {{experimental_inline}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.ontouchstart")}}, {{domxref("HTMLElement.ontouchend")}}, {{domxref("HTMLElement.ontouchmove")}}, {{domxref("HTMLElement.ontouchenter")}}, {{domxref("HTMLElement.ontouchleave")}}, and {{domxref("HTMLElement.ontouchcancel")}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.oncopy")}}, {{domxref("HTMLElement.oncut")}}, and {{domxref("HTMLElement.onpaste")}} {{Non-standard_inline}}</td>
   <td>{{CompatGeckoDesktop("1.9")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>Android</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>
    <p>{{CompatGeckoMobile("1.0")}}</p>
   </td>
   <td rowspan="7">{{CompatUnknown}}</td>
   <td rowspan="7">{{CompatUnknown}}</td>
   <td rowspan="7">{{CompatUnknown}}</td>
   <td rowspan="7">{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.accessKey", "accessKey")}}</td>
   <td>{{CompatGeckoMobile("5.0")}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.accessKeyLabel", "accessKeyLabel")}}</td>
   <td>{{CompatGeckoMobile("8.0")}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.blur()", "blur()")}}</td>
   <td>{{CompatGeckoMobile("5.0")}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.click()", "click()")}}</td>
   <td>{{CompatGeckoMobile("5.0")}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.dataset", "dataset")}}</td>
   <td>{{CompatGeckoMobile("6.0")}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.focus()", "focus()")}}</td>
   <td>{{CompatGeckoMobile("5.0")}}</td>
  </tr>
  <tr>
   <td>{{domxref("HTMLElement.oncopy")}}, {{domxref("HTMLElement.oncut")}}, and {{domxref("HTMLElement.onpaste")}} {{Non-standard_inline}}</td>
   <td>{{CompatGeckoMobile("1.9")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{domxref("Element")}}</li>
</ul>
Revert to this revision