The GMap module generates code that breaks the html validator. Not a major problem but still not clever.

The ID of the div that wraps around the map gets the id attribute twice. It seems the theme_gmap function passes the id in the element[#attributes] array to drupal_attributes() as well using the element[#id] to assign the divs id.

Lines 1103 to 1108 in gmap.module…

 $element['#attributes']['class'] = trim($element['#attributes']['class'] .'gmap gmap-map gmap-'. $map['id'] .'-gmap');

  // Some markup parsers (IE) don't handle empty inners well. Use the space to let users know javascript is required.
  // @@@ Bevan sez: Google static maps could be useful here.
  // @@@ Bdragon sez: Yeah, would be nice, but hard to guarantee functionality. Not everyone uses the static markerloader.
  $o = '<div id="'. $element['#id'] .'" style="'. implode('; ', $style) .';"'. drupal_attributes($element['#attributes']) .'>'. t('Javascript is required to view this map.') .'&lt;/div&gt;';

Not sure if there is a reason for this duplication (Javascript isn't my strong point), but simply removing the id="'. $element['#id'] .' from line 1108 should fix it.
I can't test at the moment because I'm using a macro in a body field so the GMap div ends up inside a paragraph tag, (& also fails validation).

Drew

Comments

bdragon’s picture

Status: Active » Fixed

No, you're right, it's a bug.
I just took a bunch of stuff out of that line and just put in class="gmap-nojs-warning". That should take care of it...
http://drupal.org/cvs?commit=123679

Thanks for the report!

bdragon’s picture

Status: Fixed » Active

Whoops, I accidentally changed the master div. Reverting and reopening.

bdragon’s picture

Status: Active » Fixed

OK, fixed in the original suggested way ;)

drew reece’s picture

Excellent, Thanks.

Just out of interest any idea how long it take for this to reach the stable release? Is there any kind of schedule developers follow, or is it simply when enough commits are added a release is made?

D

bdragon’s picture

It's been "As soon as possible" for a while now. Every week I hope for "This week!"

I really am working towards a stable release, I promise ;)

drew reece’s picture

LOL,

I'm not specifically targeting you, just not sure if its worth spending time patching from CVS.
To be honest it's such a minor problem I can wait a while anyway. GMap looks like a big module, pretty handy though, I dunno how you handle it with all the other stuff you commit to :)

D

drew reece’s picture

One more thing…

I figured out that wrapping macro text in a <div> causes it to not be placed inside a <p> (which also breaks validation as stated in the OP).

Simple really.
I guess someone may stumble on this and find it helpful.

D

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.