问题描述
我使用的是一个Event Listener,它指向Firefox的 relatedTarget
变量或Chrome的 toElement
变量, IE浏览器。但是,因为我做了代码的父母变量的一部分。为什么?
I am using an Event Listener that refer to the relatedTarget
variable for Firefox or the toElement
variable for Chrome and IE. But since I made that part of the code the parent variable changed. Why?
例如,在今天之前,我需要使用 evt.Va.toElement
来引用 toElement
变量,但从今天上午开始,我需要使用 evt.Xa.toElement
。为什么它会改变?
For example, before today I needed to use evt.Va.toElement
to refer to the toElement
variable but since this morning I need to use evt.Xa.toElement
. Why did it change?
google.maps.event.addListener(polygon,"mouseout",function(evt){ // Mouseout
if(evt.Xa.toElement){ // For Chrome and IE
if(evt.Xa.toElement.id != "idName"){
// Do something
}
} else {
// Do something else
}
}
有没有方法可以使用 toElement
或 relatedTarget
并确保它始终工作?
Is there a way to use toElement
or relatedTarget
and be certain that it will always work?
推荐答案
evt.Xa是一个未记录的属性,不应该用于任何事情,它可以随任何版本(闭包编译器会为每个版本重新分配未记录的属性)。只有记录的属性可以安全地用于生产代码。
evt.Xa is an undocumented property, and shouldn't be used for anything, it could change with any release of the API (the closure compiler reassigns the undocumented properties with each release). Only documented properties are safe to use in production code.
这篇关于Google.Maps.Event设置 - Va与Xa的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!