Obscure Internet Explorer Bugs: #1 of… who knows?


The Web Standards Group presented ten questions to Tommy Olsson, one of which addresses the thorny issue of the abbr and acronym elements in HTML.

Tommy’s discussion of this was informative, and I was particularly entertained by his assertion that

Netscape invented ABBR, while Microsoft invented ACRONYM, and both types meant the same thing. Then the W3C incorporated both in HTML 3, but with subtly different semantics. Microsoft’s meaning of ACRONYM was replaced by something different, which made the people at Microsoft so furious that to this day they still don’t support the ABBR element type!

as I came across a manifestation of this (possibly imaginary) dislike for the abbr element in Internet Explorer quite recently.

Consider the following markup fragment:

An example of an abbreviation might be Ltd., used in the UK to denote a private company with limited liability.

One would expect a browser which supports HTML 4 (which IE is claimed to have done since version 4) to produce a DOM structure as follows:

  • Element: p
    • Text: An example of an abbreviation might be
    • Element: abbr
      • Text: Ltd.
    • Text: , used in the UK to denote a private company with limited liability.

Whereas IE actually produces the following:

  • Element: p
    • Text: An example of an abbreviation might be
    • Element: abbr
    • Text: Ltd.
    • Element: /abbr
    • Text: , used in the UK to denote a private company with limited liability.

Yes, that’s correct: the initial abbr is parsed into an element, the text within remains as a childNode of the paragraph, and an element with the name /abbr is created.

If you try to use the createElement method of the document to create such an element, you naturally get an exception. But internally, IE manages to create an element whose name begins with a slash.

I don’t have a PC at home, so I can’t check right now whether or not spurious markup like Hello produces the same result, but I’ll check at work tomorrow and report back.

Long-delayed update: The example above does indeed produce the same results.

, ,

One response to “Obscure Internet Explorer Bugs: #1 of… who knows?”

  1. Yep, any unknown tag is treated as an empty element by IE. I tried this:

    <!DOCTYPE HTML><HTML><HEAD><TITLE></TITLE></HEAD><BODY><P><FOO></FOO></P></BODY></HTML>

    …and then:

    javascript:(function(){ var elms = document.getElementsByTagName(“*”), i = elms.length; while(i–){ alert(elms[i].tagName); }})()

    It also seems to treat the DOCTYPE as an element, with a tagName of “!”. 🙂