[whatwg] usemap="" and related issues

Ian Hickson wrote:
> On Thu, 26 Jun 2008, Jonas Sicking wrote:
>>> On Sat, 18 Aug 2007, Jonas Sicking wrote:
>>>> Since ID is case sensitive everywhere else, I don't see a reason to make
>>>> an exception from that rule here. That seems to unnecessarily complicate
>>>> implementation as well as introduce weird inconsistencies for authors.
>>> It already is inconsistent for usemap="". At least for legacy Web 
>>> content I don't think we can do much about it. At that point, I'd 
>>> rather just extend that to XHTML than to keep another difference.
>> In mozilla for HTML we only look at the name attribute, and only do so 
>> case insensitively. For XHTML we only look at the id attribute, and are 
>> always case sensitive.
>>
>> We have had a number of bugs filed on id not working on HTML, (with most 
>> of them pointing at the XHTML spec as a reason it should work) but they 
>> all use the same casing for the usemap attribute and the id attribute.
>>
>> Do you have any data showing that using case sensitive matching for the 
>> id attribute would break compatibility with any pages?
> 
> I do not. It seems like something where being incompatible with what IE 
> does is unnecessary, though.

I just did a little bit of testing, but it seems like IE *always* treat 
id's in a case insensitive manner, including for getElementById. If we 
are duplicating that quirk then we should do it consistently, not just 
for image maps.

However I don't think we should.

>> What I did notice in our code though is how we deal with the case when 
>> there are multiple <map>s with the same name. In this case we generally 
>> use the first <map>. But if the first <map> is empty, we use the first 
>> non-empty <map>. This was done for compatibility with some sites. See 
>> https://bugzilla.mozilla.org/show_bug.cgi?id=264624
>>
>> I have no idea if this matters today or not.
> 
> I couldn't reproduce this behavior.

Try the following markup in firefox:

<map name="foo"></map>
<map name="foo">
   <area shape=circle coords="10,10,10" href="http://www.mozilla.com">
</map>
<img src="http://www.mozilla.org/images/feature-logos1.png"
      usemap="#foo" width="20" height="20">

You'll note that the second image map is used. However if you insert any 
<area>s in the first image map, then the first image map will be used.

I don't know if this is important or not these days, I'd love to remove 
this behavior, but at least when the above bug was filed there were 
sites depending on it. Data would be great.

/ Jonas

Received on Wednesday, 26 November 2008 11:24:41 UTC