[whatwg] id vs. name on iframe, object and map

I did some testing on id="" and name="" on <iframe>, <object> and <map>...

    http://hasather.net/test/html/id-vs-name/

(Thanks to David for uploading them -- FTP didn't work for me today.)


In the table below, A means "link opens in "iframe"", B means "link opens  
in new window", C means "link opens in same window", and D means "no link".



   Test  | Gecko WebKit Opera IE7 |          Title            |  Notes
--------+------------------------+---------------------------+----------
001.htm | A     A      A     A   | <iframe name>             | Interop
001.xml | B     A      A     -   | <iframe name>             | -
002.htm | B     A      A     B   | <iframe id>               | -
002.xml | A     A      A     -   | <iframe id>               | -
003.htm | B     B      B     B   | <object name>             | Interop
003.xml | B     A      B     -   | <object name>             | -
004.htm | B     B      B     B   | <object id>               | Interop
004.xml | B     B      B     -   | <object id>               | Interop
005.htm | A     A      A     B   | <object name data=data:,> | IE bug?
005.xml | B     A      A     -   | <object name data=data:,> | -
006.htm | B     B      A     B   | <object id data=data:,>   | -
006.xml | A     B      A     -   | <object id data=data:,>   | -
007.htm | C     C      C     C   | <map name>                | Interop
007.xml | D     C      C     -   | <map name>                | -
008.htm | D     D      C     C   | <map id>                  | -
008.xml | C     C      C     -   | <map id>                  | Interop


So... let's see what is interoperable...:

<a target> pointing to <iframe name> works in all, except in Gecko in  
XHTML.

<a target> pointing to an <object> that is not iframeish opens a new  
window in all, except in WebKit in XHTML.

<a target> pointing to an iframeish <object name> works in all except IE7,  
and also not in Gecko in XHTML.

<map name> works in all except in Gecko in XHTML and WebKit in XHTML.

<map id> works in all in XHTML.


Looking at each browser's results individually, Opera's seems to be most  
useful and predictable. I think this is what should be specced as to what  
UAs must do. Having differences between HTML and XHTML here is not useful  
IMHO.


Looking at this from an author's perspective, it seems using name="" is  
most reliable, and if we want some sort of consistency here, then I think  
target="" must point to an <iframe name> or an iframeish <object name> (as  
opposed to <iframe id> or <object id>), and usemap="" must point to a <map  
name> (as opposed to <map id>). <map> is not useful without a usemap=""  
pointing to it, so name="" could be a required attribute on <map>.

-- 
Simon Pieters

Received on Saturday, 21 April 2007 15:04:32 UTC