jenkins-bot has submitted this change and it was merged.

Change subject: HTMLForm: Don't render 'mw-htmlform-submit-buttons' if there 
aren't any buttons
......................................................................


HTMLForm: Don't render 'mw-htmlform-submit-buttons' if there aren't any buttons

Visually, this only affects OOUIHTMLForm, in other kinds of forms
the element has no height anyway.

Change-Id: I90e73c49fbefec23532368848bb30b2e7b69075c
---
M includes/htmlform/HTMLForm.php
M includes/htmlform/OOUIHTMLForm.php
M includes/htmlform/VFormHTMLForm.php
3 files changed, 15 insertions(+), 9 deletions(-)

Approvals:
  Jforrester: Looks good to me, but someone else must approve
  Florianschmidtwelzow: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php
index 2b6a0aa..6f88975 100644
--- a/includes/htmlform/HTMLForm.php
+++ b/includes/htmlform/HTMLForm.php
@@ -1146,10 +1146,12 @@
                        }
                }
 
-               $html = Html::rawElement( 'span',
-                       [ 'class' => 'mw-htmlform-submit-buttons' ], 
"\n$buttons" ) . "\n";
+               if ( !$buttons ) {
+                       return '';
+               }
 
-               return $html;
+               return Html::rawElement( 'span',
+                       [ 'class' => 'mw-htmlform-submit-buttons' ], 
"\n$buttons" ) . "\n";
        }
 
        /**
diff --git a/includes/htmlform/OOUIHTMLForm.php 
b/includes/htmlform/OOUIHTMLForm.php
index 4f8365e..278d453 100644
--- a/includes/htmlform/OOUIHTMLForm.php
+++ b/includes/htmlform/OOUIHTMLForm.php
@@ -121,10 +121,12 @@
                        ] + $attrs );
                }
 
-               $html = Html::rawElement( 'div',
-                       [ 'class' => 'mw-htmlform-submit-buttons' ], 
"\n$buttons" ) . "\n";
+               if ( !$buttons ) {
+                       return '';
+               }
 
-               return $html;
+               return Html::rawElement( 'div',
+                       [ 'class' => 'mw-htmlform-submit-buttons' ], 
"\n$buttons" ) . "\n";
        }
 
        protected function wrapFieldSetSection( $legend, $section, $attributes 
) {
diff --git a/includes/htmlform/VFormHTMLForm.php 
b/includes/htmlform/VFormHTMLForm.php
index c446615..f3cba48 100644
--- a/includes/htmlform/VFormHTMLForm.php
+++ b/includes/htmlform/VFormHTMLForm.php
@@ -137,9 +137,11 @@
                        $buttons .= Html::element( 'input', $attrs ) . "\n";
                }
 
-               $html = Html::rawElement( 'div',
-                       [ 'class' => 'mw-htmlform-submit-buttons' ], 
"\n$buttons" ) . "\n";
+               if ( !$buttons ) {
+                       return '';
+               }
 
-               return $html;
+               return Html::rawElement( 'div',
+                       [ 'class' => 'mw-htmlform-submit-buttons' ], 
"\n$buttons" ) . "\n";
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/284901
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I90e73c49fbefec23532368848bb30b2e7b69075c
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to