From d039c9b4b23f622eb51084c0f8dacaa928326947 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 26 Oct 2016 22:37:35 +0000 Subject: [PATCH] Customize: Remove unnecessary code for edit shortcuts which is no longer required due to moving buttons inside of partial placement containers. Props sirbrillig. Amends [38967]. See #27403. git-svn-id: https://develop.svn.wordpress.org/trunk@38972 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/css/customize-preview.css | 5 -- .../js/customize-selective-refresh.js | 50 ------------------- 2 files changed, 55 deletions(-) diff --git a/src/wp-includes/css/customize-preview.css b/src/wp-includes/css/customize-preview.css index 7ce4fce8c3..a388488769 100644 --- a/src/wp-includes/css/customize-preview.css +++ b/src/wp-includes/css/customize-preview.css @@ -92,11 +92,6 @@ body.customize-partial-edit-shortcuts-flash .customize-partial-edit-shortcut:bef visibility: hidden; } -.widget button.customize-partial-edit-shortcut-absolute, -.customize-partial-edit-shortcut-absolute { - position: static; -} - .customize-partial-edit-shortcut-left-margin:before { left: 0; } diff --git a/src/wp-includes/js/customize-selective-refresh.js b/src/wp-includes/js/customize-selective-refresh.js index 953105775d..e6532136fe 100644 --- a/src/wp-includes/js/customize-selective-refresh.js +++ b/src/wp-includes/js/customize-selective-refresh.js @@ -141,62 +141,12 @@ wp.customize.selectiveRefresh = ( function( $, api ) { var partial = this, $placementContainer; $placementContainer = $( placement.container ); $placementContainer.prepend( $editShortcut ); - if ( 'absolute' === $placementContainer.css( 'position' ) ) { - $editShortcut.addClass( 'customize-partial-edit-shortcut-absolute' ); - $editShortcut.css( partial.getEditShortcutPositionStyles( $placementContainer ) ); - partial.whenPageChanges( function() { - $editShortcut.css( partial.getEditShortcutPositionStyles( $placementContainer ) ); - } ); - } if ( ! $placementContainer.is( ':visible' ) || 'none' === $placementContainer.css( 'display' ) ) { $editShortcut.addClass( 'customize-partial-edit-shortcut-hidden' ); } $editShortcut.toggleClass( 'customize-partial-edit-shortcut-left-margin', $editShortcut.offset().left < 1 ); }, - /** - * Call a callback function when the page changes. - * - * This calls a callback for any change that might require refreshing the edit shortcuts. - * - * @since 4.7 - * - * @param {Function} callback The function to call when the page changes. - * @returns {void} - */ - whenPageChanges: function( callback ) { - var debouncedCallback, $document; - debouncedCallback = _.debounce( function() { - // Timeout allows any page animations to finish - setTimeout( callback, 100 ); - }, 350 ); - // When window is resized. - $( window ).resize( debouncedCallback ); - // When any customizer setting changes. - api.bind( 'change', debouncedCallback ); - $document = $( window.document ); - // After scroll in case there are fixed position elements - $document.on( 'scroll', debouncedCallback ); - // After page click (eg: hamburger menus) - $document.on( 'click', debouncedCallback ); - }, - - /** - * Return the CSS positioning for the edit shortcut for a given partial placement. - * - * @since 4.7 - * - * @param {jQuery} $placementContainer The placement container element as a jQuery object. - * @return {Object} Object containing CSS positions. - */ - getEditShortcutPositionStyles: function( $placementContainer ) { - return { - top: $placementContainer.css( 'top' ), - left: $placementContainer.css( 'left' ), - right: 'auto' - }; - }, - /** * Return the unique class name for the edit shortcut button for this partial. *