(bug 40384) Move width/height from button to img
authorKevin Israel <pleasestand@live.com>
Fri, 28 Sep 2012 02:53:06 +0000 (22:53 -0400)
committerKevin Israel <pleasestand@live.com>
Fri, 28 Sep 2012 02:53:06 +0000 (22:53 -0400)
The fix for bug 34768 (r112710, regarding the lack of width and height
attributes for the Vector skin's search button) failed to include the
corresponding changes to SkinTemplate.php.

Because BaseTemplate::makeSearchButton() only special cased the src and
alt attributes, the width and height incorrectly went on the button
element, causing HTML validation errors (and also having no effect).
This patch moves the width and height attributes to the img element
in a similar fashion to src and alt.

Change-Id: I3561fc79364ce43521823bad691c9b61f87ba375

includes/SkinTemplate.php

index dfd7dca..5c8ffa6 100644 (file)
@@ -1783,11 +1783,15 @@ abstract class BaseTemplate extends QuickTemplate {
                                );
                                unset( $buttonAttrs['src'] );
                                unset( $buttonAttrs['alt'] );
+                               unset( $buttonAttrs['width'] );
+                               unset( $buttonAttrs['height'] );
                                $imgAttrs = array(
                                        'src' => $attrs['src'],
                                        'alt' => isset( $attrs['alt'] )
                                                ? $attrs['alt']
                                                : $this->translator->translate( 'searchbutton' ),
+                                       'width' => isset( $attrs['width'] ) ? $attrs['width'] : null,
+                                       'height' => isset( $attrs['height'] ) ? $attrs['height'] : null,
                                );
                                return Html::rawElement( 'button', $buttonAttrs, Html::element( 'img', $imgAttrs ) );
                        default: