Skip to content

Commit

Permalink
Fix: Spacer widget renders redundant markup when the space is empty o…
Browse files Browse the repository at this point in the history
…r set to 0 [ED-13898] (elementor#25292)

Co-authored-by: ElementorBot <[email protected]>
  • Loading branch information
rami-elementor and elementorbot authored Feb 28, 2024
1 parent d348df5 commit 0d01b7b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions includes/widgets/spacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,13 @@ protected function register_controls() {
'size_units' => [ 'px', 'em', 'rem', 'vh', 'custom' ],
'range' => [
'px' => [
'min' => 10,
'max' => 600,
],
'em' => [
'min' => 0.1,
'max' => 20,
],
],
'render_type' => 'template',
'selectors' => [
'{{WRAPPER}}' => '--spacer-size: {{SIZE}}{{UNIT}};',
],
Expand All @@ -139,6 +138,11 @@ protected function register_controls() {
* @access protected
*/
protected function render() {
$settings = $this->get_settings_for_display();

if ( empty( $settings['space'] ) || empty( $settings['space']['size'] ) || 0 === $settings['space']['size'] ) {
return;
}
?>
<div class="elementor-spacer">
<div class="elementor-spacer-inner"></div>
Expand All @@ -156,6 +160,11 @@ protected function render() {
*/
protected function content_template() {
?>
<#
if ( '' === settings.space || '' === settings.space.size || 0 === settings.space.size ) {
return;
}
#>
<div class="elementor-spacer">
<div class="elementor-spacer-inner"></div>
</div>
Expand Down

0 comments on commit 0d01b7b

Please sign in to comment.