We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

重定向 Document.hasFocus()

 

在 HTML5 工作草案中,DOM 属性 activeElement 与方法 hasFocus() 为程序员提供了更好的控制页面交互的能力,特别是对于用户行为引发的交互。例如,它们都可以用于统计使用目的,跟踪页面特定链接的点击次数,计算元素获得焦点的次数等等。此外,当与 AJAX 技术结合以后,将会减少向服务器请求的数目,这取决于用户的活跃程度和页面的布局。

浏览器兼容性

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 Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? 3.6 (1.9.2)[1] ? ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 4.0 (2.0)[1] ? ? ?

浏览器相关注释

Gecko notes

[1] Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5) 开始,Firefox 会在任意 tabindex 值大于 0 的元素周围绘制一个焦点框,而不只是一小部分元素。一部分元素例外: <input>, <button>, <select>, <textarea>, <iframe>, <frame>, <body><html>

另请参阅

文档标签和贡献者

标签: 
此页面的贡献者: xgqfrms-GitHub, kmc947373, sxxxsz, Breezewish, teoli, sunnylost
最后编辑者: xgqfrms-GitHub,