My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1724: Incorrect infoWindow size/margins when setting the content through an element, rather than string
10 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  May 2010


Sign in to add a comment
 
Reported by [email protected], Sep 18, 2009
The behavior depends on the actual content of the element. If it begins with:
<p>, <h3>, ......... then bottom margin is too small (practically non-existent)
<div>, <span> ...... then bottom margin is too large
<br />, <hr /> ..... then the margins work correctly

When the content is set through string (e.g. obtained through innerHTML
property), rather than through element (e.g. obtained by cloneNode method),
all seems fine.

Some links:
http://www.artprodesign.com/gmaps-example1
http://www.artprodesign.com/gmaps-example2
http://www.artprodesign.com/gmaps-example3
Oct 12, 2009
#1 d.l%[email protected]
(No comment was entered for this change.)
Status: Confirmed
Labels: Internal-2183573
Oct 21, 2009
#2 [email protected]
another case: the info window contains an image that is scaled via css, for example:

http://alex.homelinux.net/~alex/gmaps/poc_bug1.html

if the css rule is changed from 

#map_canvas .foo { width: 400px; }

 to 

.foo { width: 400px; }

it works fine again
Nov 11, 2009
#3 [email protected]
I've been struggling with this issue for a while and I was hopping it had been fixed
by now, but apparently not.  In my experience it has little to do with whether the
content is a string or a Node and has more to do with the complexity of the HTML
passed in as content.  The more involved the HTML is, the less likely the infoWindow
is to render correctly the first time it is opened.  And I don't know if this is the
case for everybody else, but for me the infoWindow always renders correctly the
second time I open it.

The workaround I use to deal with this problem is to enclose the HTML content in a
<div> CSS-styled with 'visibility: hidden;'.  The first time the infoWindow's
domready is triggered, I trigger a 'content_changed' event.  On subsequent infoWindow
domready events, I restyle the <div> with 'visibility: visible;':

    // .css for infowindowcontent:
    //  .infowindowcontent {visibility: hidden;}
    var html = '<div class="infowindowcontent">' + complexhtml + '</div>';
    var infowindow = new google.maps.InfoWindow({
        content: html
    });
    infowindow.set("redrawn", false);
    
    google.maps.event.addListener(infowindow, "domready", function() {
    	if (infowindow.get("redrawn")) {
            jQuery('.infowindowcontent').css('visibility', 'visible');
    	}
    	else {
    	    google.maps.event.trigger(infowindow, 'content_changed');
    	    infowindow.set("redrawn", true);
    	}	        		
    });

Works every time--no more partially rendered infoWindows.  Hope this helps.

Nov 12, 2009
#4 [email protected]
This bug report relates solely to different rendering of content while set through a
string and a Node. If there are other cases when infoWindow borders are rendered
incorrectly, please report them as a individual bugs.

Here are links for the very same content, buggy - set through a node, and 2 working
ones set through a string (2nd one includes even the grouping div, to make sure that
is not the cause for different rendering):
http://www.artprodesign.com/gmaps-example1
http://www.artprodesign.com/gmaps-example1-string1.html
http://www.artprodesign.com/gmaps-example1-string2.html

May 11, 2010
#5 [email protected]
(No comment was entered for this change.)
Status: FixedNotReleased
May 13, 2010
Project Member #6 [email protected]
(No comment was entered for this change.)
Labels: Fixed-41
May 13, 2010
Project Member #7 [email protected]
(No comment was entered for this change.)
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting