SharePoint, DOCTYPE, and Master Pages

Published 18 November 07 11:28 PM | shawnfel 

SharePoint by default does not support taking IE out of quirks mode.  This is discussed in a great blog entry by Heather Solomon.  Not enforcing a dtd through the DOCTYPE element in the default.master (for example
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd")

Caused me a lot of problems since Height 100% is not honored.  Specifically the Reporting Services Add-in for Sharepoint is reliant on the height=100% property of tables.  It was necessary for me to include the doctype then.  This created some other issues in that it broke some of the other scripts in sharepoint.  This is because when ie is in quirks mode document.body is the root document element but when the DOCTYPE is applied, document.documentElement becomes the root element.  Alot of these discoveries can be made using script debugging in IE

Here's a sample of a script i had to change in IE55UP.js....

function MSOLayout_GetRealOffset(StartingObject,OffsetType, EndParent)
{
 var realValue=0;
 if(!EndParent) EndParent=document.documentElement;
 if(EndParent==null){
     EndParent = document.body;
 }
 for (var currentObject=StartingObject; currentObject !=EndParent && currentObject !=document.documentElement && currentObject !=document.body; currentObject=currentObject.offsetParent)
 {
  realValue+=eval('currentObject.offset'+OffsetType)
 }
 return realValue;

Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Emil Stenström said on March 25, 2008 9:41 AM:

Hi Shawn, I just wanted to really thank you for posting your findings about this. Iäll try them right away. THANKS!

# Emil Stenström said on March 25, 2008 9:55 AM:

Yes, now I can move webparts again. Wonderful, you just saved me a week of debugging.

# emailandthings said on November 25, 2008 6:06 PM:

dont you just love sharepoint?

[ oh wait 2010 will be better...  ]

Leave a Comment

(required) 
(optional)
(required) 

About shawnfel

I'm a consultant for Microsoft Consulting Services specializing in SharePoint and BI Products. I've been with Microsoft since 03/2006. The opinions expressed herein are my own personal opinions and do not represent my employer's views in anyway.

Search

Go

This Blog

Syndication

Page view tracker