Ticket #1550 (closed feature: wontfix)

Opened 5 years ago

Last modified 4 years ago

IE7 resize event problem

Reported by: ksgeograf Owned by: crschmidt
Priority: major Milestone: 2.9 Release
Component: general Version: 2.7
Keywords: Cc:
State:

Description

In IE7, if you try to read the size of an element, it will immediately fire the "resize" event. If the code reading the size is activated by the event, it returns width/height = 0 for all known properties (ie, clientWidth, scrollWidth, etc.).

This causes problems in IE7, because updateSize() in Map.js calls getCurrentSize().

updateSize is the event handler for the resize event, and getCurrentSize tries to read the size of the element. In my solution, this causes the page to momentarily stop working, because the map is resized to 0 width, and 0 height. Usually the onload event of the layer restores functionality, but ocasionally not.

I have summed up my changes in a patch for the trunk version of Map.js. It may not be completely correct, because I developed the change for 2.5, and have not yet upgraded.

Attachments

IE7 resize fix.diff Download (1.8 KB) - added by ksgeograf 5 years ago.
IE7.diff Download (0.7 KB) - added by ksgeograf 5 years ago.
Fix for OL 2.7 (please read discussion below before applying)

Change History

Changed 5 years ago by ksgeograf

Changed 5 years ago by ksgeograf

  • milestone set to 2.7 Release

Changed 5 years ago by crschmidt

  • priority changed from minor to major

Changed 5 years ago by crschmidt

  • owner set to crschmidt
  • status changed from new to assigned

Changed 5 years ago by crschmidt

  • state set to Awaiting User Feedback

ksgeograf,

"In IE7, if you try to read the size of an element, it will immediately fire the "resize" event."

I can't reproduce this behavior. How are you reading the size of an element that this happens? I tried via map.div.clientWidth, map.style.width -- neither seems to cause a resize event. Additionally, I tried *setting* the map size, and it fired the resize event, but nowhere did I get values of 0.

Can you offer a code example that reproduces this behavior?

Changed 5 years ago by euzuro

  • milestone changed from 2.7 Release to 2.8 Release

Good three weeks with no input from bug submitter. Let's move this to 2.8 and if we still haven't heard anything by then, we can mark it invalid.

Changed 5 years ago by ksgeograf

  • version changed from 2.6 to 2.7

I appologize for not responding to this issue, I expected to be notified by email, but that was not the case. I have tried to enter my email again, and hope to get notifications in the future.

I have just switched to OL 2.7, and can see the same problem.

The problem mentioned happens frequently when using the ZoomBox control. I have the "resize" transition effect on, if that explains better. I hope to produce an example of the error with no cluttering stuff.

Changed 5 years ago by ksgeograf

I think it's only clientHeight that triggers the behavior.

I've tried to set up a simple example, but failed. I've tried stripping down my own application to a minimum, but the error stays. I've tried piling up on a simple example, but cannot trigger it.

It might be a poorly handled event on my part, but it works in Firefox, Opera, Chrome and Safari.

I've spent most of the day trying to fix it in IE7, and the fix I put up for 2.5 does not work for OL 2.7. If I fix it, I will report it.

Changed 5 years ago by ksgeograf

Fix for OL 2.7 (please read discussion below before applying)

Changed 5 years ago by ksgeograf

I finally fixed the problem (see attached fix). Unfortunately the fix requires that the OL div is filling out the entire document. I always use OL in an IFrame, so for me the fix is good enough, but should probably not be included in the main OL code.

I'm a bit surprised that no-one else has reported similar problems? The initial symptom I got was a message in IE7 (with debugging turned on): "this.center is null", and looking into the stack trace, reveals that the getCurrentSize() call triggers the chain of events (a "resize" on the div), which in turn calls "move", and then again getCurrentSize().

Changed 4 years ago by crschmidt

  • state Awaiting User Feedback deleted
  • milestone changed from 2.8 Release to 2.9 Release

I still haven't seen this reported, and the patch here is unfortunately not appropriate for OpenLayers itself. With that in mind, I'm bumping this to 2.9 for further investigation at some point in the future, but I don't think we can do anything serious for this in 2.8.

Changed 4 years ago by ksgeograf

  • status changed from assigned to closed
  • resolution set to wontfix

Understandable, I'm closing the ticket. If someone else experience the problem, they can reopen.

Note: See TracTickets for help on using tickets.