Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#9046 closed bug (invalid)

$(document).ready happens too soon in IE and causes Bing Map undefined error when drawing a polygon

Reported by: arsen Owned by: arsen
Priority: low Milestone: 1.next
Component: core Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:

Description

There seems to be an issue on pages that are based on ASP.NET Web Forms (with ScriptManager) platform and that include Bing Maps API v7.0

When the map is initialized in the $(document).ready jQuery function, it appears to happen a bit too early and results in intermittent "undefined" errors in veapicore.js.

To fix the problem, the map initialization code needs to be moved from $(document).ready to Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded() event handler.

The pageLoaded() always happens AFTER the $(document).ready and the undefined error is resolved.

It is possible that there is something special about IE browser and Bing Map V7 that uses VML or other elements that load slower and that $(document).ready is not catching these.

Change History (6)

comment:1 Changed 8 years ago by timmywil

Component: unfiledcore
Owner: set to arsen
Priority: undecidedlow
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case that reproduces the issue experienced to help us assess your ticket.

My first thought is you may simply need to bind to $(window).load instead to wait for the VML to load, which is probably what add_pageLoaded is doing.

comment:2 Changed 8 years ago by anonymous

Hi,

Thank you for the $(window).load suggestion. When using $(window).load instead of $(document).ready the Bing Map works fine.

This issue can be closed.

comment:3 Changed 8 years ago by timmywil

Resolution: invalid
Status: pendingclosed

Thanks for looking into it.

comment:4 Changed 8 years ago by anonymous

This bit me pretty hard and I wasted quite a bit of time on it, even to the point of digging, by hand, fruitlessly (of course), through the Bing Maps' minified javascript source code.

I disagree that this isn't a valid bug, but at least, for the sake of posterity, and helping the next person coming along from a google search, I'll put a few keywords here.

Bing Maps v7 IE Internet Explorer polygon undefined null VML error exception

comment:5 in reply to:  4 Changed 7 years ago by anonymous

Replying to anonymous:

This bit me pretty hard and I wasted quite a bit of time on it, even to the point of digging, by hand, fruitlessly (of course), through the Bing Maps' minified javascript source code.

I disagree that this isn't a valid bug, but at least, for the sake of posterity, and helping the next person coming along from a google search, I'll put a few keywords here.

Bing Maps v7 IE Internet Explorer polygon undefined null VML error exception

I agree completely! Just because there is a *workaround* doesn't mean that it isn't broken!!

Thanks for the tags that lead me here by the way!

--Mikey

comment:6 Changed 7 years ago by dmethvin

There's no test case indicating that jQuery was at fault here.

Note: See TracTickets for help on using tickets.