I have been working on a sharepoint intranet that consists of various document libraries for specific departments. Each department has it's own Document page, driven by 5+ content queries (pulling documents based on Department Tag and Taxonomy Tag, eg 'Policies and Procedures' or 'Forms'.
I ran into a very strange issue when several of these content queries returned no results. If the content queries return results, everything is fine. However, when no results are returned, unexplainable things begin to happen.
A couple of sharepoints containers (s4-workspace, s4-bodycontainer, etc..) and several containers from the page layout were duplicated outside of the <body> tags. On top of this, the footer (from the master page layout) is no longer in proper dom order. Rather than being after 's4-container', it is buried deep within a webpart zone in the page layout.
I managed to prevent the duplication of containers by adding a container around the contents of the page layout.
However, the footer still remains buried in the webpart mentioned above. I wrote javascript to check if the footer is in the right place, and append it to the right spot if not.
I cannot piece together what is causing this, besides possibly a bug in Sharepoint 2k13. I've commented out all Javascript/CSS and verified the integrity of my dom structure. All seems to be in order.
A very strange problem... If anyone has had any similar problems, or any insight into the problem, it would be much appreciated!