Open Bug 322370 Opened 15 years ago Updated 2 years ago

Imagemap doesn't work properly if attribute 'coords' from <area> starts with comma. ie: coords=",10,10..."


(Core :: DOM: Core & HTML, defect, P5)





(Reporter: gribas, Unassigned)




(Keywords: testcase)


(5 files, 1 obsolete file)

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" />
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.
Attached file Web page showing bug (obsolete) —
Attached image Image for imagemap
Attached image Image for imagemap
This looks great for me in 1.5. Gustavo, could you download 1.5 and see if this is fixed for yourself as well?
Version: Trunk → 1.8 Branch
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
Gustavo, I think I see the problem, but could you make a new testcase and use the URLs of the images; e.g. so the images will show up correctly?
Keywords: testcase
Attached patch Test CaseSplinter Review
Attachment #207508 - Attachment is obsolete: true
Attached file Web page showing bug
I think this is actually a parser bug...
Assignee: jdunn → mrbkap
Component: Layout: Images → HTML: Parser
QA Contact: layout.images → parser
Actually parsing the attribute value is a content/html sort of thing.
Component: HTML: Parser → DOM: HTML
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?
(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.
Component: DOM: HTML → DOM: Core & HTML
QA Contact: parser → general
Assignee: mrbkap → nobody
Hixie claims space, comma and semicolon.
Ever confirmed: true
Hardware: x86 → All
Version: 1.8 Branch → Trunk
What file needs to be modified to include the cases in comment #12 or as per URL ?

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.