According to standard the default type for <button> elements is "submit". Depending on compatibility mode IE might use "button", instead.
To work around the IE bug this patch forces the standard "submit", if nothing is specified explicitly.
See remarks on http://msdn.microsoft.com/en-us/library/ie/ms535211%28v=vs.85%29.aspx :
-----
The default value of the type attribute depends on the current document compatibility mode. The default value is submit. In other compatibility modes the default value is button.
...
Windows Internet Explorer 8 and later. The default value of the type attribute depends on the current document compatibility mode. In IE8 Standards mode, the default value is submit.
In other compatibility modes and earlier versions of Windows Internet Explorer, the default value is button.
-----
Change-Id: I3b97a8cac74bbfca63699dfcbf1cc5e9a2cef193
unset( $attribs['maxlength'] );
}
unset( $attribs['maxlength'] );
}
+ // According to standard the default type for <button> elements is "submit".
+ // Depending on compatibility mode IE might use "button", instead.
+ // We enforce the standard "submit".
+ if ( $element == 'button' && !isset( $attribs['type'] ) ) {
+ $attribs['type'] = 'submit';
+ }
+
return "<$element" . self::expandAttributes(
self::dropDefaults( $element, $attribs ) ) . '>';
}
return "<$element" . self::expandAttributes(
self::dropDefaults( $element, $attribs ) ) . '>';
}
'button' => array(
'formaction' => 'GET',
'formenctype' => 'application/x-www-form-urlencoded',
'button' => array(
'formaction' => 'GET',
'formenctype' => 'application/x-www-form-urlencoded',
),
'canvas' => array(
'height' => '150',
),
'canvas' => array(
'height' => '150',
}
public function testExpandAttributesSkipsNullAndFalse() {
}
public function testExpandAttributesSkipsNullAndFalse() {
### EMPTY ########
$this->assertEmpty(
Html::expandAttributes( array( 'foo' => null ) ),
### EMPTY ########
$this->assertEmpty(
Html::expandAttributes( array( 'foo' => null ) ),
- * Test out Html::element drops default value
+ * Test out Html::element drops or enforces default value
* @cover Html::dropDefaults
* @dataProvider provideElementsWithAttributesHavingDefaultValues
*/
* @cover Html::dropDefaults
* @dataProvider provideElementsWithAttributesHavingDefaultValues
*/
'area', array( 'shape' => 'rect' )
);
'area', array( 'shape' => 'rect' )
);
- $cases[] = array( '<button></button>',
+ $cases[] = array( '<button type=submit></button>',
'button', array( 'formaction' => 'GET' )
);
'button', array( 'formaction' => 'GET' )
);
- $cases[] = array( '<button></button>',
+ $cases[] = array( '<button type=submit></button>',
'button', array( 'formenctype' => 'application/x-www-form-urlencoded' )
);
'button', array( 'formenctype' => 'application/x-www-form-urlencoded' )
);
- $cases[] = array( '<button></button>',
- 'button', array( 'type' => 'submit' )
- );
$cases[] = array( '<canvas></canvas>',
'canvas', array( 'height' => '150' )
$cases[] = array( '<canvas></canvas>',
'canvas', array( 'height' => '150' )
'input', array( 'type' => 'range', 'value' => '' ),
);
'input', array( 'type' => 'range', 'value' => '' ),
);
+ # <button> specific handling
+ # see remarks on http://msdn.microsoft.com/en-us/library/ie/ms535211%28v=vs.85%29.aspx
+ $cases[] = array( '<button type=submit></button>',
+ 'button', array( 'type' => 'submit' ),
+ 'According to standard the default type is "submit". Depending on compatibility mode IE might use "button", instead.',
+ );
+
# <select> specifc handling
$cases[] = array( '<select multiple></select>',
'select', array( 'size' => '4', 'multiple' => true ),
# <select> specifc handling
$cases[] = array( '<select multiple></select>',
'select', array( 'size' => '4', 'multiple' => true ),