I was getting the infamous IE8 error HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917) when trying to use and attach fake body to html. Little testing and trying and I came to the solution that attached body only when it’s actually needed for checking, and that’s in two places, but with additional check to se if it’s available inside docElement.
HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
Is this making any sense? :)
@niksy so sorry you were ignored :[[[
Would you be able to rebase this off of master?
Build details: https://travis-ci.org/modernizr-savage/Modernizr/builds/88341676
(Please note that this is a fully automated comment.)
@patrickkettner now I’m sorry for keeping this unchecked :)
I’ve rebased this with the master and pushed the changes.
Again, I suppose this adjustment is valid, method only attaches fake body if it doesn’t exist on page and it does that only in blocks where there is a call for removeFakeBody.
Also, I’m working on a project which uses Flash detection and from time to time I would get two body elements which probably come from lack of proper cleanup. It’s really rare, but when checking for existence of body elements via document.querySelectorAll('body'), I get two elements and problems start to happen then (some scripts look for body at specific time and they get fake body which doesn’t have any children). If there is only one body element, everything works OK.
The fix looks good, but could you fixup the style issues?
Flash: Attach fake body only when actually needed
@patrickkettner sure! I’ve made amends to the commit and now everything should be fine.
thanks so much!