From 624ef8b4e36c92b7ced95ccb1f7e5462a0d2cca7 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 5 Jul 2011 09:44:58 -0400 Subject: [PATCH] - Patch #1162802 by Liam Morland: Asterisk * used for required or changed marker should be in abbr not span. --- includes/form.inc | 2 +- misc/ajax.js | 10 +++++----- misc/states.js | 2 +- misc/tabledrag.js | 4 ++-- modules/field/field.form.inc | 2 +- modules/simpletest/tests/form.test | 8 ++++---- modules/system/system.theme.css | 3 +++ themes/garland/style.css | 2 +- 8 files changed, 18 insertions(+), 15 deletions(-) diff --git a/includes/form.inc b/includes/form.inc index c2495e222de..23636d038ee 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -3916,7 +3916,7 @@ function theme_form_required_marker($variables) { 'class' => 'form-required', 'title' => $t('This field is required.'), ); - return '*'; + return '*'; } /** diff --git a/misc/ajax.js b/misc/ajax.js index 830c8aa1c98..92eefea952d 100644 --- a/misc/ajax.js +++ b/misc/ajax.js @@ -202,16 +202,16 @@ Drupal.ajax = function (base, element, element_settings) { * will test to see if the key press is valid to trigger this event and * if it is, trigger it for us and prevent other keypresses from triggering. * In this case we're handling RETURN and SPACEBAR keypresses (event codes 13 - * and 32. RETURN is often used to submit a form when in a textfield, and - * SPACE is often used to activate an element without submitting. + * and 32. RETURN is often used to submit a form when in a textfield, and + * SPACE is often used to activate an element without submitting. */ Drupal.ajax.prototype.keypressResponse = function (element, event) { // Create a synonym for this to reduce code confusion. var ajax = this; // Detect enter key and space bar and allow the standard response for them, - // except for form elements of type 'text' and 'textarea', where the - // spacebar activation causes inappropriate activation if #ajax['keypress'] is + // except for form elements of type 'text' and 'textarea', where the + // spacebar activation causes inappropriate activation if #ajax['keypress'] is // TRUE. On a text-type widget a space should always be a space. if (event.which == 13 || (event.which == 32 && element.type != 'text' && element.type != 'textarea')) { $(ajax.element_settings.element).trigger(ajax.element_settings.event); @@ -559,7 +559,7 @@ Drupal.ajax.prototype.commands = { if (!$(response.selector).hasClass('ajax-changed')) { $(response.selector).addClass('ajax-changed'); if (response.asterisk) { - $(response.selector).find(response.asterisk).append(' * '); + $(response.selector).find(response.asterisk).append(' * '); } } }, diff --git a/misc/states.js b/misc/states.js index ec070c9a676..b01bc2b6892 100644 --- a/misc/states.js +++ b/misc/states.js @@ -363,7 +363,7 @@ states.State.prototype = { $(document).bind('state:required', function(e) { if (e.trigger) { if (e.value) { - $(e.target).closest('.form-item, .form-wrapper').find('label').append('*'); + $(e.target).closest('.form-item, .form-wrapper').find('label').append('*'); } else { $(e.target).closest('.form-item, .form-wrapper').find('label .form-required').remove(); diff --git a/misc/tabledrag.js b/misc/tabledrag.js index b566168c354..95fe713b802 100644 --- a/misc/tabledrag.js +++ b/misc/tabledrag.js @@ -1141,7 +1141,7 @@ Drupal.tableDrag.prototype.row.prototype.removeIndentClasses = function () { Drupal.tableDrag.prototype.row.prototype.markChanged = function () { var marker = Drupal.theme('tableDragChangedMarker'); var cell = $('td:first', this.element); - if ($('span.tabledrag-changed', cell).length == 0) { + if ($('abbr.tabledrag-changed', cell).length == 0) { cell.append(marker); } }; @@ -1161,7 +1161,7 @@ Drupal.tableDrag.prototype.row.prototype.onSwap = function (swappedRow) { }; Drupal.theme.prototype.tableDragChangedMarker = function () { - return '*'; + return '*'; }; Drupal.theme.prototype.tableDragIndentation = function () { diff --git a/modules/field/field.form.inc b/modules/field/field.form.inc index 66d93e96320..9250a51c434 100644 --- a/modules/field/field.form.inc +++ b/modules/field/field.form.inc @@ -250,7 +250,7 @@ function theme_field_multiple_value_form($variables) { if ($element['#cardinality'] > 1 || $element['#cardinality'] == FIELD_CARDINALITY_UNLIMITED) { $table_id = drupal_html_id($element['#field_name'] . '_values'); $order_class = $element['#field_name'] . '-delta-order'; - $required = !empty($element['#required']) ? '*' : ''; + $required = !empty($element['#required']) ? '*' : ''; $header = array( array( diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index e7ae9de3f9e..4d969290615 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -65,7 +65,7 @@ class FormsTestCase extends DrupalWebTestCase { $elements['file']['empty_values'] = $empty_strings; // Regular expression to find the expected marker on required elements. - $required_marker_preg = '@\*@'; + $required_marker_preg = '@\*@'; // Go through all the elements and all the empty values for them. foreach ($elements as $type => $data) { @@ -598,16 +598,16 @@ class FormsElementsLabelsTestCase extends DrupalWebTestCase { // Exercise various defaults for textboxes and modifications to ensure // appropriate override and correct behaviour. - $elements = $this->xpath('//label[@for="edit-form-textfield-test-title-and-required"]/child::span[@class="form-required"]/parent::*/following-sibling::input[@id="edit-form-textfield-test-title-and-required"]'); + $elements = $this->xpath('//label[@for="edit-form-textfield-test-title-and-required"]/child::abbr[@class="form-required"]/parent::*/following-sibling::input[@id="edit-form-textfield-test-title-and-required"]'); $this->assertTrue(isset($elements[0]), t("Label preceeds textfield, with required marker inside label.")); - $elements = $this->xpath('//input[@id="edit-form-textfield-test-no-title-required"]/preceding-sibling::label[@for="edit-form-textfield-test-no-title-required"]/span[@class="form-required"]'); + $elements = $this->xpath('//input[@id="edit-form-textfield-test-no-title-required"]/preceding-sibling::label[@for="edit-form-textfield-test-no-title-required"]/abbr[@class="form-required"]'); $this->assertTrue(isset($elements[0]), t("Label tag with required marker preceeds required textfield with no title.")); $elements = $this->xpath('//input[@id="edit-form-textfield-test-title-invisible"]/preceding-sibling::label[@for="edit-form-textfield-test-title-invisible" and @class="element-invisible"]'); $this->assertTrue(isset($elements[0]), t("Label preceeding field and label class is element-invisible.")); - $elements = $this->xpath('//input[@id="edit-form-textfield-test-title"]/preceding-sibling::span[@class="form-required"]'); + $elements = $this->xpath('//input[@id="edit-form-textfield-test-title"]/preceding-sibling::abbr[@class="form-required"]'); $this->assertFalse(isset($elements[0]), t("No required marker on non-required field.")); $elements = $this->xpath('//input[@id="edit-form-textfield-test-title-after"]/following-sibling::label[@for="edit-form-textfield-test-title-after" and @class="option"]'); diff --git a/modules/system/system.theme.css b/modules/system/system.theme.css index d8dbc513b5a..f34a965ec99 100644 --- a/modules/system/system.theme.css +++ b/modules/system/system.theme.css @@ -104,6 +104,9 @@ input.form-radio { .form-required { color: #f00; } +abbr.form-required, abbr.tabledrag-changed, abbr.ajax-changed { + border-bottom: none; +} .form-item input.error, .form-item textarea.error, .form-item select.error { diff --git a/themes/garland/style.css b/themes/garland/style.css index f36fa96549f..4a5961c6199 100644 --- a/themes/garland/style.css +++ b/themes/garland/style.css @@ -264,7 +264,7 @@ tr:first-child td.category { border-top-width: 0; } -span.form-required { +abbr.form-required { color: #ffae00; }