Browse files

Wrap the img in a span instead of a div

This resolves a *fascinating* IE complaint.  IE apparently holds .innerHTML to
being rigorously standards-compliant, producing "Unknown runtime error"s if
you incorrectly nest elements.  Thus placing a div inside a p makes everything
go to hell.  Span is the most inoffensive element I could think of, and it's
semantically neutral, so it should be fine.
  • Loading branch information...
kemayo committed Mar 21, 2008
1 parent 50fa120 commit 8b68344e29e89642ca0926eca5e211529708da45
Showing with 2 additions and 2 deletions.
  1. +1 −1 jquery.maphilight.js
  2. +1 −1 jquery.maphilight.min.js
@@ -104,7 +104,7 @@
options = $.metadata ? $.extend({}, opts, img.metadata()) : opts;
map = $('map[name="'+img.attr('usemap').substr(1)+'"]');
if(!('img') && img.attr('usemap') && map.size() > 0 && !img.hasClass('maphilighted'))) { return; }
- img.wrap($('<div style="background:url('+this.src+');position: relative; padding: 0; width: '+this.width+'px; height: '+this.height+'px"></div>'));
+ img.wrap($('<span style="display:block;background:url('+this.src+');position:relative;padding:0;width:'+this.width+'px;height:'+this.height+'px"></div>'));
img.css('opacity', 0).css('border', 0).css(canvas_style);
if($.browser.msie) { img.css('filter', 'Alpha(opacity=0)'); }

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 8b68344

Please sign in to comment.