Referencing <map> from usemap=''

In reference to:
IRC discussion yesterday (logs broken)
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2007-April/ 
010975.html
http://www.whatwg.org/specs/web-apps/current-work/#valid7
http://hsivonen.iki.fi/test/moz/usemap/
https://bugzilla.mozilla.org/show_bug.cgi?id=109445
http://ln.hixie.ch/?start=1172653243&count=1

The effort to eradicate <a name=''> and replacing it with id='' has  
worked pretty well for fragment identifiers in links from the point  
of view of authoring new content. The same is not true for <map  
name=''>.

  1) Referring to <map id='...'> in text/html doesn't work in Gecko  
and WebKit.
  2) Referring to <map name='...'> in application/xhtml+xml does not  
work in Gecko.
  3) The current draft makes <map name='...'> non-conforming.
  4) The spec has a concept called "hashed ID reference" that isn't  
specified to match on IDness. This confused me enough that I  
initially wrote spec-wise broken code.

  * With my conformance checker developer hat on, I don't like <map  
name=''> being non-conforming when real-world compat with Gecko and  
WebKit requires the use of <map name='...'> in text/html. I think  
authors aren't helped if a conformance checker tells them not to use  
what has worked in text/html since the introduction of client-side  
image maps.

  * In general, trying to migrate from <map name='...'> to <map  
id='...'> seems like an exercise in theoretical purity. In  
retrospect, back when the id attribute was introduced in HTML, it  
might have been a better idea to allow the name attribute on all  
elements instead. Too late for that now. However, given that the  
syntax for the value of usemap does not look like a traditional IDREF  
anyway, I don't think keeping the name attribute on map would be such  
a bad idea.

  * Having different browser behavior for text/html and application/ 
xhtml+xml is bad for being able to easily switch between the two  
serializations.

  * In XHTML, Opera matches on ID not just id. (That is, xml:id and a  
random attribute declared as ID in the internal subset work.) The  
spec calls the concept "hashed ID reference" but specifies matching  
the id attribute name. If the spec continues to require matching on  
the attribute name, the concept should not use upper-case ID in the  
name. OTOH, if the spec intends to codify Opera's behavior it should  
specify matching on any ID. (I don't think matching on any ID is  
practically valuable.)

Suggestion:
Promote <map name='...'> as the preferred image map naming mechanism  
and make name='' a required attribute for document conformance. For  
document conformance, require id='' to have the same value as name=''  
if id='' is present in addition to name=''.

Aside:
It might be a good idea to affirm that spaces aren't trimmed on  
matching. (Consider usemap='#map ', name='map ' and name='map'.)

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Tuesday, 16 October 2007 12:31:44 UTC