为什么Firefox event.offsetX和offsetY未定义? [英] Why Firefox event.offsetX and offsetY are undefined?
问题描述
我偶然发现了仅在Firefox上发生的软件错误.原因是该事件未定义offsetX和offsetY.
I just stumbled upon a bug in my software that happened only on Firefox. The reason was that the event didn't have offsetX and offsetY defined.
感谢此.
无论如何,我的问题不是编程帮助请求.我很好奇为什么Firefox中未定义这些属性?背后的原因是什么?
Anyways, my question is not a programming help request. I'm just curious why these properties are undefined in Firefox? What is the reason behind it?
我确实浏览了以下内容: DOM3 MouseEvent规范.和 DOM2鼠标事件规范..
I did look through: DOM3 UIEvent Spec., DOM3 MouseEvent Spec. and DOM2 MouseEvent Spec..
似乎没有提到任何属性,所以,我想这是其他浏览器中引入的非官方属性吗?
It appears that neither of the properties are mentioned there, so, I suppose that's an unofficial property introduced in other browsers?
推荐答案
Although mentioned in the W3 specification, the offsetx
/offsety
properties themselves are implemented inconsistently across browsers.
尽管在IE,Webkit浏览器和Opera中受支持,但它们的功能都与规范要求略有不同,但IE除外- .
While supported in IE, Webkit browsers and Opera, they all function slightly different to the specifications requirements, except for IE - according to the "Calculating offsetX, offsetY" section here.
Firefox完全不支持这些属性-似乎是 长期存在的错误 ,尚待解决.
The properties aren't supported in Firefox at all - it appears to be a long-time bug that is yet to be resolved.
我想这是另一种引入的非官方性质 浏览器?"
"I suppose that's an unofficial property introduced in other browsers?"
我认为这是一个官方财产,只是Firefox中尚未实现.如果它是非官方的IE属性,则不会在W3规范中提到的Webkit/Opera浏览器中实现,也不会由Firefox实际尝试实现(请查看上面的错误链接).
I believe it's an official property, that just hasn't been implemented in Firefox. If it was a non-official IE property, it wouldn't have been implemented in the Webkit/Opera browsers, mentioned in the W3 spec nor would Firefox actually be trying to implement it (check out the bug link above).
这篇关于为什么Firefox event.offsetX和offsetY未定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!