SharePoint, DOCTYPE, and Master Pages
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" "https://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;
}
Comments
Anonymous
March 25, 2008
Hi Shawn, I just wanted to really thank you for posting your findings about this. Iäll try them right away. THANKS!Anonymous
March 25, 2008
Yes, now I can move webparts again. Wonderful, you just saved me a week of debugging.Anonymous
November 25, 2008
dont you just love sharepoint? [ oh wait 2010 will be better... ]