[wp-trac] [WordPress Trac] #22037: Customizer: Live preview fetches page but does not display
WordPress Trac
noreply at wordpress.org
Sat Oct 27 19:34:37 UTC 2012
#22037: Customizer: Live preview fetches page but does not display
-------------------------------------------------+-------------------------
Reporter: marcoliverteschke | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
Component: Appearance | Review
Severity: normal | Version: 3.4.2
Keywords: needs-testing needs-refresh has- | Resolution:
patch |
-------------------------------------------------+-------------------------
Changes (by wdfee):
* keywords: needs-testing needs-refresh needs-patch => needs-testing
needs-refresh has-patch
Comment:
ok, found this, too. in /wp-includes/class-wp-customize-manager.php you
defined the signature and added it with this action hook in line 336:
{{{
add_action( 'shutdown', array( $this, 'customize_preview_signature' ),
1000 );
}}}
If it's added to shutdown, the signature is posted, but not part of
response, so the index is undefined. I changed it to
{{{
add_action( 'wp_footer', array( $this, 'customize_preview_signature' ),
1000 );
}}}
and similarly changed it on the remove_action hook on line 417. Now the
signature variable is added to the footer of the response and lastIndexOf
build correctly. But now it's added earlier than '</html>', so of course
lastIndexOf smaller. I'm not sure, what the condition "index <
response.lastIndexOf('</html>')" is for exactly, but I suggest to change
it to
{{{
// Check for a signature in the request.
index = response.lastIndexOf( signature );
if ( -1 === index || index < response.lastIndexOf('<body>') ) {
deferred.rejectWith( self, [ 'unsigned' ] );
//return;
}
// Strip the signature from the request.
response = response.slice( 0, index ) + response.slice( index +
signature.length );
// Create the iframe and inject the html content.
self.iframe = $('<iframe />').appendTo( self.container );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22037#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list