I am being stupid, here. I used gumbo to change the code on the fly that is given to Preview (see the end of PreviewWindow.cpp). And gumbo will happily mend any and all errors! So even though CodeView shows the error (missing body), gumbo will repair it if and only if it changes the code to use vh and vw.
So the code being displayed by Preview will be different than the code shown in CodeView. To see this, if we load a page without a body start tag that gets the 100% changed to 100vh and 100vw and we fire up the Inspector and look at the code, we will see the body node was happily added back in before being loaded into Preview.
So the only way around this is to use gumbo just to test for whether to make the change or not (it is a complex set of conditions) and then use regular expressions to make the actual change.
I will try to code that up tomorrow.
|