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

Change subject: Fix HTML output arround HTMLForm's submit buttons when in vform
......................................................................


Fix HTML output arround HTMLForm's submit buttons when in vform

$html in HTMLForm::getButtons() is vrapped in a <div></div> when in
vform mode but it contains a <span> tag without its closing
counterpart, thus making the HTML invalid.

And while I'm at it: put line breaks at better places.

Change-Id: I7ffa1bdd72d95188320c1b29d1c46a5f6f434cbe
---
M includes/htmlform/HTMLForm.php
1 file changed, 19 insertions(+), 18 deletions(-)

Approvals:
  Mattflaschen: Looks good to me, approved
  Bartosz Dziewoński: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php
index 5621b01..6af2f5f 100644
--- a/includes/htmlform/HTMLForm.php
+++ b/includes/htmlform/HTMLForm.php
@@ -787,7 +787,7 @@
         * @return String HTML.
         */
        function getButtons() {
-               $html = '<span class="mw-htmlform-submit-buttons">';
+               $buttons = '';
 
                if ( $this->mShowSubmit ) {
                        $attribs = array();
@@ -812,24 +812,17 @@
                                array_push( $attribs['class'], 'mw-ui-button', 
'mw-ui-big', 'mw-ui-primary', 'mw-ui-block' );
                        }
 
-                       $html .= Xml::submitButton( $this->getSubmitText(), 
$attribs ) . "\n";
-
-                       // Buttons are top-level form elements in table and div 
layouts,
-                       // but vform wants all elements inside divs to get 
spaced-out block
-                       // styling.
-                       if ( $this->isVForm() ) {
-                               $html = Html::rawElement( 'div', null, 
"\n$html\n" );
-                       }
+                       $buttons .= Xml::submitButton( $this->getSubmitText(), 
$attribs ) . "\n";
                }
 
                if ( $this->mShowReset ) {
-                       $html .= Html::element(
-                                       'input',
-                                       array(
-                                               'type' => 'reset',
-                                               'value' => $this->msg( 
'htmlform-reset' )->text()
-                                       )
-                               ) . "\n";
+                       $buttons .= Html::element(
+                               'input',
+                               array(
+                                       'type' => 'reset',
+                                       'value' => $this->msg( 'htmlform-reset' 
)->text()
+                               )
+                       ) . "\n";
                }
 
                foreach ( $this->mButtons as $button ) {
@@ -847,10 +840,18 @@
                                $attrs['id'] = $button['id'];
                        }
 
-                       $html .= Html::element( 'input', $attrs );
+                       $buttons .= Html::element( 'input', $attrs ) . "\n";
                }
 
-               $html .= '</span>';
+               $html = Html::rawElement( 'span',
+                       array( 'class' => 'mw-htmlform-submit-buttons' ), 
"\n$buttons" ) . "\n";
+
+               // Buttons are top-level form elements in table and div layouts,
+               // but vform wants all elements inside divs to get spaced-out 
block
+               // styling.
+               if ( $this->mShowSubmit && $this->isVForm() ) {
+                       $html = Html::rawElement( 'div', null, "\n$html" ) . 
"\n";
+               }
 
                return $html;
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7ffa1bdd72d95188320c1b29d1c46a5f6f434cbe
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Daniel Friesen <[email protected]>
Gerrit-Reviewer: IAlex <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Spage <[email protected]>
Gerrit-Reviewer: Swalling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to