Details/summary polyfill: Set closed details visibility to hidden to make text nodes invisible (although still take up space)

Fixes #6166
I know, what I am saying is that you should add a comment in the code for the benefit of developers that may wonder why and may not have seen the original PR