Code-Only: BASE tag changes in IE 7 with Examples

This is a quick helper reference showing the differences in the DOM trees after parsing HTML files with one or more BASE tags. We show the original HTML followed by the Pre IE 7 DOM Tree and finally the IE 7 DOM Tree. This can be used as reference to help fix up any pages that may be broken by the new compliant behavior.

Sample DOM Trees with a BASE tag in the HEAD element

Original HTML:
<HTML>
 <HEAD>
  <TITLE></TITLE>
  <BASE>
  <LINK>
 </HEAD>
 <BODY>
 </BODY>
</HTML>

Pre IE 7 DOM Tree:
<HTML>
 <HEAD>
  <TITLE></TITLE>
  <BASE>
   <LINK>
  </BASE>
 </HEAD>
 <BASE>
  <BODY>
  </BODY>
 </BASE>
</HTML>

IE 7 DOM Tree:
<HTML>
 <HEAD>
  <TITLE></TITLE>
  <BASE>
  <LINK>
 </HEAD>
 <BODY>
 </BODY>
</HTML>

Sample DOM Trees with a BASE tags in the BODY element

Original HTML:
<HTML>
 <BODY>
  <BASE>
  <IMG>
  <BASE>
  <IMG>
 </BODY>
</HTML>

Pre IE 7 DOM Tree:
<HTML>
 <BODY>
  <BASE>
   <IMG>
   <BASE>
    <IMG>
   </BASE>
  </BASE>
 </BODY>
</HTML>

IE 7 DOM Tree:
<HTML>
 <BODY>
  <BASE> <!-- Ignored -->
  <IMG>
  <BASE> <!-- Ignored -->
  <IMG>
 </BODY>
</HTML>

Sample DOM Trees with a BASE tag and TITLE in an implied HEAD

Original HTML:
 <TITLE></TITLE>
 <BASE>
 <IMG>

Pre IE 7 DOM Tree:
<HTML>
 <HEAD>
  <TITLE></TITLE>
  <BASE></BASE>
 </HEAD>
 <BASE>
  <BODY>
   <IMG>
  </BODY>
 </BASE>
</HTML>

IE 7 DOM Tree:
<HTML>
 <HEAD>
  <TITLE></TITLE>
  <BASE>
 </HEAD>
 <BODY>
  <IMG>
 </BODY>
</HTML>

Published Saturday, August 27, 2005 6:22 PM by Justin Rogers
Filed under:

Comments

Friday, June 29, 2007 9:00 AM by Mutiny Design

# re: Code-Only: BASE tag changes in IE 7 with Examples

Interesting. Surprised to see that someone  else takes note of the base tag.

Saturday, June 21, 2008 3:00 PM by info@getoninter.net

# re: Code-Only: BASE tag changes in IE 7 with Examples

thanks for this code!

Tuesday, July 29, 2008 11:19 AM by FMN Media

# re: Code-Only: BASE tag changes in IE 7 with Examples

Interesting, thanks

Tuesday, August 05, 2008 3:10 AM by Creativ Era's

# re: Code-Only: BASE tag changes in IE 7 with Examples

This is a great recourse. Interesting fact about the base tag.

Thanks for sharing it.

Leave a Comment

(required) 
(required) 
(optional)
(required)