Last Comment Bug 322370 - Imagemap doesn't work properly if attribute 'coords' from <area> starts with comma. ie: coords=",10,10..."
: Imagemap doesn't work properly if attribute 'coords' from <area> starts with ...
Status: NEW
: testcase
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- minor with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
: Andrew Overholt [:overholt]
Mentors:
http://www.whatwg.org/html/#rules-for...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-04 09:56 PST by Gustavo
Modified: 2012-06-09 21:29 PDT (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Web page showing bug (2.28 KB, text/html)
2006-01-04 10:00 PST, Gustavo
no flags Details
Image for imagemap (1.35 KB, image/gif)
2006-01-04 10:01 PST, Gustavo
no flags Details
Image for imagemap (1.51 KB, image/gif)
2006-01-04 10:02 PST, Gustavo
no flags Details
Test Case (2.72 KB, patch)
2006-01-11 02:39 PST, Gustavo
no flags Details | Diff | Splinter Review
Web page showing bug (2.72 KB, text/html)
2006-01-11 02:42 PST, Gustavo
no flags Details
<area coords> test page (2.50 KB, text/html; charset=utf-8)
2006-03-01 03:27 PST, Aiko
no flags Details

Description Gustavo 2006-01-04 09:56:22 PST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; pt-BR; rv:1.7.12) Gecko/20050919 Firefox/1.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; pt-BR; rv:1.7.12) Gecko/20050919 Firefox/1.0.7

If the 'coords' attribute of an area tag starts with a leading comma then firefox/mozilla/netscape fails to layout it properly.  Ex:
   <MAP name="map01">
     <AREA shape="poly" coords=",50,50,50,150,150,150,50,50" />
   </MAP>
Sometimes the shape is deformed, sometimes it doesn't show at all. 

Reproducible: Always

Steps to Reproduce:
1. Go to the example URL

Actual Results:  
If you move your mouse over the pictures whose imagemaps have a leading comma in the 'coords' attribute you'll notice that the shapes are deformed or don't appear at all.

Expected Results:  
The leading comma should be ignored.

Works fine on Opera, Konqueror, Icesoft java browser and InternetExplorer.
Comment 1 Gustavo 2006-01-04 10:00:56 PST
Created attachment 207508 [details]
Web page showing bug
Comment 2 Gustavo 2006-01-04 10:01:50 PST
Created attachment 207509 [details]
Image for imagemap
Comment 3 Gustavo 2006-01-04 10:02:23 PST
Created attachment 207510 [details]
Image for imagemap
Comment 4 Adam Guthrie 2006-01-08 22:12:25 PST
This looks great for me in 1.5. Gustavo, could you download 1.5 and see if this is fixed for yourself as well?
Comment 5 Gustavo 2006-01-09 02:39:36 PST
It didn't work for me. Adam, are you sure you checked the whole area of the two bottom pictures?

Here's the version I've tried:Mozilla/5.0 (Windows; U; Windows NT 5.0; pt-BR; rv:1.8) Gecko/20051111 Firefox/1.5
Comment 6 Adam Guthrie 2006-01-10 13:56:00 PST
Gustavo, I think I see the problem, but could you make a new testcase and use the URLs of the images; e.g. https://bugzilla.mozilla.org/attachment.cgi?id=207509 so the images will show up correctly?
Comment 7 Gustavo 2006-01-11 02:39:52 PST
Created attachment 208189 [details] [diff] [review]
Test Case
Comment 8 Gustavo 2006-01-11 02:42:59 PST
Created attachment 208191 [details]
Web page showing bug
Comment 9 Adam Guthrie 2006-01-12 15:19:36 PST
I think this is actually a parser bug...
Comment 10 Blake Kaplan (:mrbkap) 2006-01-12 17:14:42 PST
Actually parsing the attribute value is a content/html sort of thing.
Comment 11 Jonas Sicking (:sicking) No longer reading bugmail consistently 2006-01-12 18:39:24 PST
it'd be pretty easy to just skip initial commas, but if we're going to emulate IE we might as well check more thoroughly what they do. What other junk characters can you stick at the beginning of the string without making IE change what it parses into?
Comment 12 Aiko 2006-03-01 03:25:32 PST
(In reply to comment #11)
> What other junk
> characters can you stick at the beginning of the string without making IE
> change what it parses into?

I'll attach a test page next, but here is a short summary of my findings to answer your question. Given the input |coords="C1,2,3,4"|, Internet Explorer 6's result is
 - 1,2,3,4 if C is element of { Space + , ; No-break-space } or one of the Unicode space characters, range 0x2000-0x200b
 - -1,2,3,4 if C is -
 - 0,2,3,4 in all other cases

Other cases are more complicated and depend on the value of 'shape'. F.e.:

coords="1,2" shape="rect" -> coords="1,2,0,0"
coords="1,2" shape="poly" -> coords=""
coords="1,2" shape="circle" -> coords="1,2,0"
coords"1;5,2,3,4" shape="rect" -> coords="1,3,2,5"
coords"1;5,2,3,4" shape="poly" -> coords="1,5,2,3,4,0"
coords="1Q5,2,3,4,6" shape="poly" -> coords="0,2,3,4,6,0"

Basically, most of the times IE tries to extract the required number of values (4 for rect, 3 for circle, even for poly) from coords and fills missing numbers with 0.
Comment 13 Aiko 2006-03-01 03:27:01 PST
Created attachment 213567 [details]
<area coords> test page
Comment 14 :Ms2ger (⌚ UTC+1/+2) 2010-12-06 11:19:39 PST
Hixie claims space, comma and semicolon.
Comment 15 Shriram (irc: Mavericks) Away 2012-06-09 21:29:54 PDT
What file needs to be modified to include the cases in comment #12 or as per URL ?

Note You need to log in before you can comment on or make changes to this bug.