gachseang / google-maps-utility-library-v3

Automatically exported from code.google.com/p/google-maps-utility-library-v3
0 stars 0 forks source link

IE9 opacity issue #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Demo link or sample code:

Under InfoBox.prototype.setBoxStyle_, when this line is run under IE9:

___________
if (typeof this.div_.style.opacity !== "undefined") {
  this.div_.style.filter = "alpha(opacity=" + (this.div_.style.opacity * 100) + ")";
}
___________

it will set the opacity to zero and the infobox will not display.  

I was able to "correct" this by adding:

___________
&& navigator.appVersion != "5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; 
x64; Trident/5.0)"
___________

to the if statement in question.

Version: 1.0 and 1.1

Browser / Operating System:
Win 7 IE9 64 bit

Original issue reported on code.google.com by Vryx.Aer...@gmail.com on 27 Sep 2010 at 8:10

GoogleCodeExporter commented 9 years ago
I don't have access to MSIE 9, so please help me out here. Does MSIE now honor 
the standard CSS opacity parameter and choke on the old filter parameter?

If so, that's likely to break a lot of software.

Before fixing I'd like to understand more about what's really causing the 
problem.

Original comment by garylitt...@gmail.com on 7 Dec 2010 at 9:35

GoogleCodeExporter commented 9 years ago
The InfoBox code always sets opacity and filter.

According to a comment I found on a MS blog -- "IE9’s standard mode supports 
only opacity and not the alpha filter."

Therefore, I would expect MSIE 9 to accept the opacity setting and ignore the 
filter setting... and everything should work as expected.

Does anyone have any insight into this issue?

Original comment by garylitt...@gmail.com on 7 Dec 2010 at 10:15

GoogleCodeExporter commented 9 years ago
It looks like it is not ignoring the filter setting, so if there is no opacity 
set in css the calculation is setting the filter to 0, and uses that value.  (I 
didn't test to see what happens if opacity and filter are set to different 
values, that might be worthwhile also...)

I hope this illustrates it better:

attachments:
step1 - IE9 mode before the if statement
step2 - IE9 mode after the if
step1ie8 - IE8 mode
works - IE9 mode with opacity set before the filter calculation 

Original comment by Vryx.Aer...@gmail.com on 8 Dec 2010 at 3:13

Attachments:

GoogleCodeExporter commented 9 years ago
Do me a favor and change the lines in question to this and tell me if it makes 
a difference:

    if (typeof this.div_.style.opacity !== "undefined" && this.div_.style.opacity !== "") {

      this.div_.style.filter = "alpha(opacity=" + (this.div_.style.opacity * 100) + ")";
    }

I've added a test to check if opacity is "" (on older versions of MSIE opacity 
is undefined if it hasn't been explicitly set; with MSIE 9 it seems to be "" 
when not explicitly set, just as with other browsers). If it is, I don't set 
filter.

Gary

Original comment by garylitt...@gmail.com on 8 Dec 2010 at 6:39

GoogleCodeExporter commented 9 years ago
That fixed the issue.

Original comment by Vryx.Aer...@gmail.com on 8 Dec 2010 at 10:03

GoogleCodeExporter commented 9 years ago
Great news. I've updated the "trunk" version of InfoBox to incorporate this 
change. I will tag it as 1.1.1 in a couple of days.

Thanks for the help. This also affected KeyDragZoom and MarkerWithLabel.

Original comment by garylitt...@gmail.com on 8 Dec 2010 at 10:41

GoogleCodeExporter commented 9 years ago
Fixed in InfoBox 1.1.1 tagged release.

Original comment by garylitt...@gmail.com on 9 Dec 2010 at 5:54