Opera onkeyup 坏了?重复,倒下时开火
当我添加任何 onkeyup
事件时,它不会执行 Opera 中应有的操作。当按住按键时(而不是松开按键时)它会重复触发。同样的事件在 Chrome 和 Firefox 中可以正常工作。我没有 keydown
或 keypressed
的监听器。
当按下按键时,这个简单的代码会将按键事件流记录到 Opera 的控制台。在 Firefox 和 Chrome 中,当释放按键时,它会记录一行(我使用的是 Mootools,但它与传统的事件附加相同,并且是否附加到任何地方:窗口、文档、文本字段...)
$(window).addEvent("keyup", trapKeyUp);
function trapKeyUp(e) {
console.log(e);
}
<强>所以我的问题是:在 Opera 的情况下,我是否在代码方面做了错误的事情,或者浏览器只是严重损坏?在这个网站和谷歌上搜索时,我没有轻易找到任何对此特定的引用问题。我在 Ubuntu 上使用最新的 Opera。
When I add any onkeyup
event, it does not do what it's supposed to in Opera. It fires repeatedly while the key is held, not when it's released. This same event works correctly in Chrome and Firefox. I have no listeners for keydown
or keypressed
.
This simple code logs a stream of key events to the console in Opera when the key is held down. In Firefox and Chrome, it logs a single line when the key is released (I'm using Mootools, but it does the same with traditional event attaching, and does it attached anywhere: window, document, a text field...)
$(window).addEvent("keyup", trapKeyUp);
function trapKeyUp(e) {
console.log(e);
}
So my question is: is there something I'm doing wrong code wise in Opera's case, or is the browser just horribly broken? In searching on this site and Google I did not readily find any references to this specific issue. I'm using the latest Opera on Ubuntu.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我知道 Opera 不会在 Windows 上重复 keyup 事件,因此这看起来像是与 Ubuntu 平台集成时的错误(错误)。如果 10.70 预览版本中仍然存在问题,请在 https://bugs.opera.com/ 报告错误Wizard/ - 如果您给我错误的参考号,我可以将其推进。
I know that Opera doesn't repeat keyup events on Windows, so it seems like an error (a bug) in the integration with the Ubuntu platform. If it is still a problem in a 10.70 preview build please report a bug at https://bugs.opera.com/wizard/ - if you give me the bug's reference number I can push it forward.
我在 Linux 上运行 Opera 时遇到了问题,键盘确实是根据操作系统中设置的自动重复的速率触发的。我测试了一下,Linux 上的 Opera 是唯一仍然这样做的浏览器,我认为它更早更常见。
我之前为此提交了一个错误,如果有帮助,请参考 ID
DSK-307269
。PS:那是几个月前的事了,所以它可能已经被修复了,但我假设你是最新的,所以情况并非如此。
来自报告错误时自动生成的电子邮件:
I've had problems with this running opera for linux, the keyup is indeed triggered at a rate according to the auto-repeat set in the OS. I tested around, and opera on linux is the only browser still doing this, I think it was more common earlier.
I filed a bug for this earlier, reference id
DSK-307269
if helps.PS: It was a couple of months ago, so it might've been fixed since, but I assume you're on the latest, so not the case.
From email auto-generated when bug reported:
它仍然发生在 Ubuntu 下的 Opera 11.50 上。虽然这并不是一个真正的问题,但知道你的代码在浏览器和/或操作系统上的工作方式不一样有点烦人。我使用此事件(onkeyup)来防止用户向服务器发送非常快速的请求,并使其挂在较慢的网络上。
it's still happen on Opera 11.50 under Ubuntu.. not really an issue though, but kinda annoying to know that your code doesn't work the same way across browser and/or operating system. i use this event (onkeyup) to prevent user sending very rapid request to the server, and making it hung on slower network.