Skip to content

Commit

Permalink
Use window.parent instead of window.top for sending resize messages
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Jul 11, 2017
1 parent 0b21a93 commit 2f7f4cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/sandbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ export default class Sandbox extends wp.element.Component {
( function() {
var observer;
if ( ! window.MutationObserver || ! document.body || ! window.top ) {
if ( ! window.MutationObserver || ! document.body || ! window.parent ) {
return;
}
function sendResize() {
var clientBoundingRect, computedStyle;
clientBoundingRect = document.body.getBoundingClientRect();
computedStyle = getComputedStyle( document.body );
window.top.postMessage( {
window.parent.postMessage( {
action: 'resize',
width: clientBoundingRect.width + parseFloat( computedStyle.marginLeft ) + parseFloat( computedStyle.marginRight ),
height: clientBoundingRect.height + parseFloat( computedStyle.marginTop ) + parseFloat( computedStyle.marginBottom )
Expand Down

0 comments on commit 2f7f4cc

Please sign in to comment.