Commit 12c2da95 authored by catch's avatar catch

Issue #2637680 by Dom., mikeocana, laranajim: Submit buttons for GET forms in...

Issue #2637680 by Dom., mikeocana, laranajim: Submit buttons for GET forms in search/views are not W3C valid due to empty 'name' attribute
parent 91965852
......@@ -325,6 +325,10 @@ function template_preprocess_vertical_tabs(&$variables) {
*/
function template_preprocess_input(&$variables) {
$element = $variables['element'];
// Remove name attribute if empty, for W3C compliance.
if (isset($variables['attributes']['name']) && empty((string) $variables['attributes']['name'])) {
unset($variables['attributes']['name']);
}
$variables['children'] = $element['#children'];
}
......
......@@ -45,6 +45,11 @@ public function testSearchFormBlock() {
$this->drupalGet('');
$this->assertText($block->label(), 'Block title was found.');
// Check that name attribute is not empty.
$pattern = "//input[@type='submit' and @name='']";
$elements = $this->xpath($pattern);
$this->assertTrue(empty($elements), 'The search input field does not have empty name attribute.');
// Test a normal search via the block form, from the front page.
$terms = array('keys' => 'test');
$this->submitGetForm('', $terms, t('Search'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment