RESOLVED FIXED 9504
img tag rewritten by innerHTML doesn't use image map
https://bugs.webkit.org/show_bug.cgi?id=9504
Summary img tag rewritten by innerHTML doesn't use image map
Martin Hinks
Reported 2006-06-19 03:39:06 PDT
Test case #1: http://www.m-s-d.net/test.htm Test case #2: http://www.m-s-d.net/test2.htm Test case #1 shows a <span> tag being rewritten to contain an img tag with a usemap property and a <map> tag complete with areas. The write works when called from anything other than the function called when the imagemap is clicked. ie. it works on page load, but rewriting the tag via a function called from a click on the imagemap does not. After the rewrite called from within the imagemap click the zonemap does not work. Test case #2 shows a <span> tag being rewritten to contain an img tag with a usemap property. The map is stored inline with the document after the span tag and not generated dynamically. In this case the zonemap never functions correctly. These behaviours work as expected in Firefox and Internet Explorer (tested on WinXP SP2)
Attachments
proposed fix (6.09 KB, patch)
2010-06-09 17:23 PDT, Alexey Proskuryakov
mitz: review+
Martin Hinks
Comment 1 2006-06-19 03:52:56 PDT
My mistake: test case #2 now shows a working example thereby showing that it is the rewrite of the map that causes the failure. (In reply to comment #0) > Test case #1: http://www.m-s-d.net/test.htm > Test case #2: http://www.m-s-d.net/test2.htm > > Test case #1 shows a <span> tag being rewritten to contain an img tag with a > usemap property and a <map> tag complete with areas. The write works when > called from anything other than the function called when the imagemap is > clicked. ie. it works on page load, but rewriting the tag via a function called > from a click on the imagemap does not. After the rewrite called from within the > imagemap click the zonemap does not work. > > Test case #2 shows a <span> tag being rewritten to contain an img tag with a > usemap property. The map is stored inline with the document after the span tag > and not generated dynamically. In this case the zonemap never functions > correctly. > > These behaviours work as expected in Firefox and Internet Explorer (tested on > WinXP SP2) >
Alexey Proskuryakov
Comment 2 2007-03-31 12:23:18 PDT
These test cases are now longer available. Reporter, could you please attach them to the bug?
Martin Hinks
Comment 3 2007-04-01 09:32:20 PDT
Alexey Proskuryakov
Comment 4 2008-11-28 13:38:44 PST
These test cases are now longer available. Reporter, could you please attach them to the bug?
Alexey Proskuryakov
Comment 5 2009-06-15 12:21:19 PDT
*** Bug 26277 has been marked as a duplicate of this bug. ***
Alexey Proskuryakov
Comment 6 2009-06-15 12:22:21 PDT
Bug 26277 has a test attached.
Don Marks
Comment 7 2009-11-04 05:49:41 PST
This problem can be worked around by renaming the old map to something inconsequential before it is replaced. For example: map.name = 'garbage'; mapparent.innerHTML = '<map name="mymap" ...';
Don Marks
Comment 8 2009-11-04 08:38:54 PST
I should add that even though this workaround seems to do the job, there is likely still a small memory leak of a reference to the now-deleted map being kept around. If the map is renamed each time to a unique name, then an even bigger memory leak would likely occur.
Alexey Proskuryakov
Comment 9 2010-06-08 14:52:54 PDT
See also: bug 19678.
Alexey Proskuryakov
Comment 10 2010-06-09 16:46:27 PDT
*** Bug 19678 has been marked as a duplicate of this bug. ***
Alexey Proskuryakov
Comment 11 2010-06-09 17:23:06 PDT
Created attachment 58314 [details] proposed fix I think that the workaround from comment 7 is a good one, there shouldn't be any memory leak.
Alexey Proskuryakov
Comment 12 2010-06-09 22:33:45 PDT
WebKit Review Bot
Comment 13 2010-06-09 23:01:52 PDT
http://trac.webkit.org/changeset/60937 might have broken SnowLeopard Intel Release (Tests)
Alexey Proskuryakov
Comment 14 2010-07-13 10:09:57 PDT
Actually landed the test at last, <http://trac.webkit.org/changeset/63217>.
Note You need to log in before you can comment on or make changes to this bug.