| @@ -77,10 +77,14 @@ | ||
| 77 | 77 | '_background' => 'background', |
| 78 | 78 | '_boxShadow' => 'box-shadow', |
| 79 | 79 | ]; |
| 80 | 80 | foreach ( $transition_types as $key => $property ) { |
| 81 | - if ( isset( $attribute[ $key ] ) ) { | |
| 82 | - $duration = ! empty( $attribute[ $key ]['transitionDuration'] ) ? $attribute[ $key ]['transitionDuration'] : '0'; | |
| 81 | + // Only add a transition when the user actually set a non-zero | |
| 82 | + // duration. Previously every block emitted the no-op | |
| 83 | + // "transition:border 0s ease,background 0s ease,box-shadow 0s ease" | |
| 84 | + // on its wrapper (0s = no transition) — dead CSS on every block. | |
| 85 | + if ( isset( $attribute[ $key ]['transitionDuration'] ) && (float) $attribute[ $key ]['transitionDuration'] > 0 ) { | |
| 86 | + $duration = $attribute[ $key ]['transitionDuration']; | |
| 83 | 87 | $transitions[] = "{$property} {$duration}s ease"; |
| 84 | 88 | } |
| 85 | 89 | } |
| 86 | 90 | $transition_string = implode( ',', $transitions ); |
| @@ -87,9 +91,9 @@ | ||
| 87 | 91 | |
| 88 | 92 | $css = array_merge( |
| 89 | 93 | Dimensions::get_css( $attribute['_margin'], 'margin', $device ), |
| 90 | 94 | Dimensions::get_css( $attribute['_padding'], 'padding', $device ), |
| 91 | - Mask::get_css( $attribute['_mask'], $device ), | |
| 95 | + Mask::get_css( $attribute['_mask'], '', $device ), | |
| 92 | 96 | Background::get_css( $attribute['_background'], 'background', $device ), |
| 93 | 97 | Border::get_css( $attribute['_border'], '', $device ), |
| 94 | 98 | Width::get_css( $attribute['_width'], 'width', $device ), |
| 95 | 99 | BoxShadow::get_css( $attribute['_boxShadow'], $device ), |
| @@ -94,9 +98,10 @@ | ||
| 94 | 98 | Width::get_css( $attribute['_width'], 'width', $device ), |
| 95 | 99 | BoxShadow::get_css( $attribute['_boxShadow'], $device ), |
| 96 | 100 | Position::get_css( $attribute['_position'], 'position', $device ), |
| 97 | 101 | Zindex::get_css( $attribute['_zIndex'], 'z-index', $device ), |
| 98 | - [ 'transition' => $transition_string ] | |
| 102 | + // Only emit transition when there's a real (non-zero) one. | |
| 103 | + '' !== $transition_string ? [ 'transition' => $transition_string ] : [] | |
| 99 | 104 | ); |
| 100 | 105 | return apply_filters( 'ablocks/get_block_common_wrapper_css', $css, $attribute, $device ); |
| 101 | 106 | } |
| 102 | 107 | public static function get_wrapper_hover_css( $attribute, $device = '' ) { |