Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Which is faster? <iframe style="display:none"> or <iframe><body style="display:none"></iframe>?

Blink aborts computing styles on descendants of display:none nodes. If the inside of the iframe has <body style="display:none">, you make remove recalc style, no layout, no painting. <iframe style="display:none"> still does all that work because it's another document and the display:none effect does not transcend into the other document.

@joseeight

This comment has been minimized.

Copy link

commented Oct 3, 2014

I don't get how these are related, they are completely two different things. If you hide the iFrame, you are obviously triggering a recalc of the parent document and elements around it, while the body of the document in the iFrame is separate and only that would be affected (fingers crossed). This is more of a question of what happens when the parent element has a set width and height and you want to hide the contents inside.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.