Custom application.master – working around Microsoft bugs
I created a very customized application.master page and I followed all the best practices I could find. I had all the right content place holders and I did not implement the search control on it. These were the two basic recommendations I could find from other people in the SharePoint field.
So, the new application.master was created and everything seemed to be working fine. Then one day we went to check in a file and noticed that we couldn’t check in. The check in page had a “title” and a “description” but everything under it was blank. I did a view source on the page and the html for the check in page was actually there, it just wasn’t showing.
At this point I was baffled. So, I decided to go look at the checkin.aspx page that SharePoint actually uses. While on this page I concentrated on the “Description” section because that was the last section that actually showed up. When I looked at the jumbled mess that Microsoft calls html it seemed to look fine (except for their inconsistent use of capitalization and tabbing – that drives me crazy :)).
So, I formatted the html a little better and I noticed something very interesting:
Now, take a close look. I always thought you had to close your td’s before closing your trs’s. This is what Microsoft gets for writing this jumbled html.
The only thing I can’t figure out is how they managed to get their application.master pages to work. There are two possiblities in my mind (but there might be others, I am just guessing here):
1. There is bad html in the regular application.master page which somehow closes the tags off.
2. Quirk mode – SharePoint runs in Quirk mode. Quirk mode is basically a way to keep non-standard html pages to render correctly. It tries to “fix” certain errors automatically. However, it has issues because every browser fixes “quirks” differently. Thus, it is never a good thing to rely on this to fix issues.
So, this is no good if you write clean html in your custom application.master page, because it is actually the Microsoft implementing page that has the error in it.
My solution to fixing this was to place the PlaceHolderPageDescription in a hidden panel on my application.master. Now, this means I will never get these descriptions in my application pages, but that is something I am willing to live with.