Index: trunk/phase3/includes/Html.php |
— | — | @@ -155,32 +155,37 @@ |
156 | 156 | return ''; |
157 | 157 | } |
158 | 158 | |
159 | | - # Remove HTML5-only attributes if we aren't doing HTML5 |
160 | | - if ( !$wgHtml5 ) { |
161 | | - if ( $element == 'input' ) { |
162 | | - # Whitelist of valid XHTML1 types |
163 | | - $validTypes = array( |
164 | | - 'hidden', |
165 | | - 'text', |
166 | | - 'password', |
167 | | - 'checkbox', |
168 | | - 'radio', |
169 | | - 'file', |
170 | | - 'submit', |
171 | | - 'image', |
172 | | - 'reset', |
173 | | - 'button', |
174 | | - ); |
175 | | - if ( isset( $attribs['type'] ) |
176 | | - && !in_array( $attribs['type'], $validTypes ) ) { |
177 | | - # Fall back to type=text, the default |
178 | | - unset( $attribs['type'] ); |
179 | | - } |
| 159 | + # Remove HTML5-only attributes if we aren't doing HTML5, and disable |
| 160 | + # form validation regardless (see bug 23769 and the more detailed |
| 161 | + # comment in expandAttributes()) |
| 162 | + if ( $element == 'input' ) { |
| 163 | + # Whitelist of types that don't cause validation. All except |
| 164 | + # 'search' are valid in XHTML1. |
| 165 | + $validTypes = array( |
| 166 | + 'hidden', |
| 167 | + 'text', |
| 168 | + 'password', |
| 169 | + 'checkbox', |
| 170 | + 'radio', |
| 171 | + 'file', |
| 172 | + 'submit', |
| 173 | + 'image', |
| 174 | + 'reset', |
| 175 | + 'button', |
| 176 | + 'search', |
| 177 | + ); |
| 178 | + if ( isset( $attribs['type'] ) |
| 179 | + && !in_array( $attribs['type'], $validTypes ) ) { |
| 180 | + unset( $attribs['type'] ); |
180 | 181 | } |
181 | | - if ( $element == 'textarea' && isset( $attribs['maxlength'] ) ) { |
182 | | - unset( $attribs['maxlength'] ); |
| 182 | + if ( isset( $attribs['type'] ) && $attribs['type'] == 'search' |
| 183 | + && !$wgHtml5 ) { |
| 184 | + unset( $attribs['type'] ); |
183 | 185 | } |
184 | 186 | } |
| 187 | + if ( !$wgHtml5 && $element == 'textarea' && isset( $attribs['maxlength'] ) ) { |
| 188 | + unset( $attribs['maxlength'] ); |
| 189 | + } |
185 | 190 | |
186 | 191 | return "<$element" . self::expandAttributes( |
187 | 192 | self::dropDefaults( $element, $attribs ) ) . '>'; |