HTMLElement 接口表示所有的 HTML 元素。一些HTML元素直接实现了HTMLElement接口,其它的间接实现HTMLElement接口.
属性
继承自父接口Element和 GlobalEventHandlers的属性
Event handlers
The events properties, of the form onXYZ, are defined on the GlobalEventHandlers, implemented by HTMLElement. A few more are specific to HTMLElement.
HTMLElement.onTouchStart- Returns the event handling code for the
touchstartevent. HTMLElement.onTouchEnd- Returns the event handling code for the
touchendevent. HTMLElement.onTouchMove- Returns the event handling code for the
touchmoveevent. HTMLElement.onTouchEnter- Returns the event handling code for the
touchenterevent. HTMLElement.onTouchLeave- Returns the event handling code for the
touchleaveevent. HTMLElement.onTouchCancel- Returns the event handling code for the
touchcancelevent.
方法
从父元素继承的方法, Element.
| Name & Arguments | Return | Description |
|---|---|---|
HTMLElement.blur() |
void |
元素失去焦点 |
HTMLElement.click() |
void |
触发元素的点击事件 |
HTMLElement.focus() |
void |
元素获得焦点 |
HTMLElement.forceSpellCheck() |
void |
规范
| Specification | Status | Comment |
|---|---|---|
| CSS Object Model (CSSOM) View Module HTMLElement |
Working Draft |
添加如下属性:
|
| WHATWG HTML Living Standard HTMLElement |
Living Standard |
添加如下属性:
|
| HTML5 HTMLElement |
Recommendation |
添加了如下属性:
|
| Document Object Model (DOM) Level 2 HTML Specification HTMLElement |
Recommendation | 在 Document Object Model (DOM) Level 2 HTML Specification基础上没有任何改变 |
| Document Object Model (DOM) Level 1 Specification HTMLElement |
Recommendation | 初始定义 |
浏览器兼容性
| 特性 | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 1.0 (1.7 or earlier) | ? | ? | ? | ? |
accessKey |
5.0 (5.0) | 17.0 | ? | ? | (Yes)(535.10) |
accessKeyLabel |
8.0 (8.0) | ? | ? | ? | 未实现WebKit 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() |
未实现 | 未实现 | 未实现 | 未实现 | 未实现 |
dataset |
6.0 (6.0) | 8.0 | 11 | 11.10 | 6 |
draggable |
(Yes) | ? | ? | 12.0 | ? |
dropzone |
未实现 | 未实现 | 未实现 | 12.0 | 未实现 |
offsetLeft, offsetTop, offsetParent, offsetHeight and offsetWidth |
(Yes) | ? | (Yes) | ? | ? |
translate |
未实现 | 未实现 | 未实现 | 未实现 | 未实现 |
itemScope, itemType, itemRef, itemId, itemProp, and itemValue |
6.0 (6.0) | 未实现 | 未实现 | 11.60 (Removed in Opera 15) |
未实现 |
properties |
(Yes) | ? | ? | ? | ? |
HTMLElement.ontouchstart, HTMLElement.ontouchend, HTMLElement.ontouchmove, HTMLElement.ontouchenter, HTMLElement.ontouchleave, and HTMLElement.ontouchcancel |
(Yes) | (Yes) | 未实现 | ? | (Yes) |
| 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) |