Skip to main content

Bug Tracker

Side navigation

#4484 closed bug (fixed)

Opened April 03, 2009 09:15AM UTC

Closed December 07, 2009 01:29AM UTC

Last modified March 13, 2012 04:46PM UTC

Can't insert html code in <map> with firefox

Reported by: Ivoire Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.4a1
Keywords: Cc:
Blocked by: Blocking:
Description

I tried ".html()" and ".append()" - both didnt work with firefox. It didnt write any code in the tag. So i used javascript ".innerHTML" which worked on both browsers (ie and firefox)

javascript

document.getElementById("map").innerHTML = html;

jquery

$("#map").html(html);

$("#map").append(html);

// html

<map id="map">

</map>

Attachments (1)
Change History (14)

Changed April 03, 2009 09:25AM UTC by Ivoire comment:1

I want to add that it only doesn't work if i try to add a <area> tag

Changed April 11, 2009 04:05PM UTC by dmethvin comment:2

resolution: → wontfix
status: newclosed

As the jQuery docs say, jQuery implements

.html()
and other methods that take HTML strings by injecting the given string into the innerHTML property of a DIV. If you try to insert content that is not valid within a DIV, it won't work. The AREA tag is only valid within a MAP. If you want to use jQuery
.html()
, create a full valid HTML fragment by including the MAP tag and nest the AREA within that.

Changed April 11, 2009 04:12PM UTC by dmethvin comment:3

need: ReviewTest Case
resolution: wontfix
status: closedreopened

Actually, there may be a simple fix for this in {{{jQuery.clean}}. Can you provide a full test case?

Changed April 14, 2009 08:44AM UTC by Ivoire comment:4

attached a simple testfile. this example works fine with ie. But if you try it in firefox it only work if you use the "document.getElementById("map").innerHTML = html;" which i commented. Hope this helps, previous snippet was to short as i saw.

Changed April 14, 2009 08:47AM UTC by Ivoire comment:5

sry - path to jquery is local in this testfile

Changed April 21, 2009 08:58AM UTC by borg42 comment:6

"As the jQuery docs say, jQuery implements .html() and other methods that take HTML strings by injecting the given string into the innerHTML property of a DIV. If you try to insert content that is not valid within a DIV, it won't work."

I don't see it in the documentation, but it seems important. Please add this (or a link to the page that contains this info) to http://docs.jquery.com/Html .

(BTW, it'd be nice if there were a gotcha/caveat section on the help pages.)

Changed April 21, 2009 09:18AM UTC by Ivoire comment:7

If you take a look at the attachment (imageMapTest.html) i have added you can see that i dont use any div in this example. I only want to add a AREA tag to the MAP. Nevertheless it doesnt work with firefox.

Changed April 21, 2009 09:49AM UTC by borg42 comment:8

Ivoire: AFAIK his point is that when you use .html(someHtmlCode), the variable someHtmlCode should contain html that would be valid html if you'd insert it to a div (and an area without a map is invalid in a div). That is, it seems you can't use .html() like that, simply because it's not supported by jQuery. You should generate the map+area tags into someHtmlCode and them append all this to the body.

I'm not sure if it's true/right or not, I'm only describing what he says.

Changed April 24, 2009 07:27AM UTC by Ivoire comment:9

Ok thx for the info, misunderstood first reading it...

Changed May 14, 2009 02:12AM UTC by dmethvin comment:10

Yep, that's what I meant. As for the possible solution, we could wrap the AREA tag in a MAP inside the DIV, then strip out the MAP. There are several other cases where that already has to be done, particularly for tables.

Changed December 07, 2009 01:29AM UTC by john comment:11

milestone: 1.3.21.4
resolution: → fixed
status: reopenedclosed
version: 1.3.21.4a1

Changed November 17, 2010 02:46AM UTC by dmethvin comment:12

#4582 is a duplicate of this ticket.

Changed February 21, 2011 10:39AM UTC by anonymous comment:13

Not working in jQuery 1.4.4

Changed February 21, 2011 12:39PM UTC by jitter comment:14

Replying to [comment:13 anonymous]:

Not working in jQuery 1.4.4

Please submit a reduced test case, which reproduces the issue you are experiencing, on http://jsfiddle.net. So that we can investigate this issue further. Also make sure to read the link given below, in order to provide a most useful bug report.


How to report bugs