Added support for visibility hidden and display none elements.