在谷歌地图中,​​getBoundingClientRect在IE中提供了未指定的错误

DDM*_*DDM 2 google-maps internet-explorer-8 google-maps-api-3 google-maps-markers

与以下问题相关: IE8上Google Maps API的未指定错误

在函数函数Mp(a,b){..}中,以下代码行触发错误var e = a.getBoundingClientRect();

  1. 要复制此错误
    1. 制作一个谷歌地图页面(确保它足够高,你有空间来滚动页面,不要让地图全屏)
    2. 放置标记
    3. 在调试模式下在IE中打开应用程序(我在10中测试过)
    4. 页面加载时,单击标记以显示信息窗口,即弹出窗口
    5. 尝试滚动页面

      你会得到错误.

getBoundingClientRect(),一个返回容器位置的IE功能.问题可能与工具提示即信息窗口有关.

更多信息:http://ejohn.org/blog/getboundingclientrect-is-awesome/

尝试了解决方案:google.maps.event.clearListeners(window,'resize'); 它无济于事.

示例应用程序:https ://googledrive.com/host/0B-Y3wXhWdoQebnBUV2RNRWhJZE0/test-shell.html礼貌:@ user2250544

phe*_*nal 8

这是一个肮脏的黑客似乎有用,如果你有这样的事情:

HTMLElement.prototype.getBoundingClientRect = (function () { 
    var oldGetBoundingClientRect = HTMLElement.prototype.getBoundingClientRect; 
    return function() { 
        try { 
            return oldGetBoundingClientRect.apply(this, arguments); 
        } catch (e) { 
            return { 
                left: '', 
                right: '', 
                top: '', 
                bottom: '' 
            }; 
        } 
    }; 
})();
Run Code Online (Sandbox Code Playgroud)