是否有所有 JavaScript 事件(onClick()
、onMouseDown()
等等)的列表以及关于哪些元素有效的信息?
(例如,onBlur
事件在除 IE 以外的大多数浏览器中对非表单事件无效。)
我知道很多事情都是“常识”(你如何focus()
在一个段落上),但我发现在开发中仅依靠常识很少得到你远。 :)
最佳答案
来源本身:http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html
查看事件下,“目标”描述资格:http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#event-type-load
除此之外的任何内容均未在规范中定义,因此不被视为无效。就像你说的,很多都是常识,并留给你的实现。
虽然有一些很好的花絮可以引发进一步的研究:
A host language may define specific elements which may or may not receive focus, the conditions user which an element may receive focus, the means by which focus may be changed, and the order in which the focus changes. For example, in some cases an element might be given focus by moving a pointer over it, while other circumstances might require a mouse click; some elements might not be focusable at all, and some might be focusable only by special means (clicking on the element), but not by tabbing to it. Documents may contain multiple focus rings. Other specifications may define a more complex focus model than is described in this specification, including allowing multiple elements to have the current focus.
关于javascript - 所有具有受支持元素的 DOM 事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6755230/