So the two snippets in this screenshot are the same page loaded in Lightning. This is the "main div" as I can see it that holds the main contents of the page. I promise it is the same page, a standard Account page layout, snapped twice, so why is it so different?
The top snip is when I view the source of the page from a fresh load (F5) of the record detail page. There is one
div "center oneCenterStage" (number 1) and this holds all the DOM for the whole detail page section, very neat. The second snip is what gets loaded into the browser when I navigate to the (same) Account page from a link within LEX... say from a List View.
NOW In that second snip, the entire DOM of my page exists within
div 1 (windowViewMode-Normal) and
div 3 (oneCenterStage) (but
div 2 (windowViewMode-minimized) is basically empty). This means some work I have on the page which is dependent on targetting a bit of the account page gets knackered - because the entire page exists twice in the DOM (Style IDs and all).
It looks fine in the browser because, in snip two,
div 3 (where the content actually was in the first case) is set to
display: none so it doesn't display, but it still does mess up the DOM because it's still there.
Why on earth is this? More importantly, how can I stop Salesforce putting the whole page in twice? It can't be good for performance either.