Fixed getting styles from disconnected nodes. Fixes #7148.