javascript 哪些浏览器支持 document.activeElement?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5318415/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 16:47:34  来源:igfitidea点击:

Which browsers support document.activeElement?

javascriptbrowserfocus

提问by philfreo

Which web browsers / versions have support for document.activeElement?

哪些网络浏览器/版本支持document.activeElement

This property lets you see which element is active / has focus.

此属性可让您查看哪个元素处于活动状态/具有焦点。

Are there any main gotchas/difference between implementations?

实现之间是否有任何主要问题/差异?

回答by Andrei

document.activeElement is supported by IE6+, FF3+, Safari 4+, Opera 9+, Chrome 9+. (FF2, Saf3 don't support this property)

IE6+、FF3+、Safari 4+、Opera 9+、Chrome 9+ 支持 document.activeElement。(FF2、Saf3 不支持此属性)

回答by Truplic

It still doesn't work on WebKit based browsers in xhtml pagesee https://bugs.webkit.org/show_bug.cgi?id=63922

它仍然不适用于xhtml 页面中基于 WebKit 的浏览器, 请参阅https://bugs.webkit.org/show_bug.cgi?id=63922