summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries Buytaert2011-07-05 13:44:58 (GMT)
committerDries Buytaert2011-07-05 13:44:58 (GMT)
commit624ef8b4e36c92b7ced95ccb1f7e5462a0d2cca7 (patch)
tree37aee618848fe190d1b93a735caf835a6b25d1e2
parentbfaf647099965864e0d3fc5b9934ad5e748dbe73 (diff)
- Patch #1162802 by Liam Morland: Asterisk * used for required or changed marker should be in abbr not span.
-rw-r--r--includes/form.inc2
-rw-r--r--misc/ajax.js10
-rw-r--r--misc/states.js2
-rw-r--r--misc/tabledrag.js4
-rw-r--r--modules/field/field.form.inc2
-rw-r--r--modules/simpletest/tests/form.test8
-rw-r--r--modules/system/system.theme.css3
-rw-r--r--themes/garland/style.css2
8 files changed, 18 insertions, 15 deletions
diff --git a/includes/form.inc b/includes/form.inc
index c2495e2..23636d0 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 '<span' . drupal_attributes($attributes) . '>*</span>';
+ return '<abbr' . drupal_attributes($attributes) . '>*</abbr>';
}
/**
diff --git a/misc/ajax.js b/misc/ajax.js
index 830c8aa..92eefea 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(' <span class="ajax-changed">*</span> ');
+ $(response.selector).find(response.asterisk).append(' <abbr class="ajax-changed" title="' + Drupal.t('Changed') + '">*</abbr> ');
}
}
},
diff --git a/misc/states.js b/misc/states.js
index ec070c9..b01bc2b 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('<span class="form-required">*</span>');
+ $(e.target).closest('.form-item, .form-wrapper').find('label').append('<abbr class="form-required" title="' + Drupal.t('This field is required.') + '">*</abbr>');
}
else {
$(e.target).closest('.form-item, .form-wrapper').find('label .form-required').remove();
diff --git a/misc/tabledrag.js b/misc/tabledrag.js
index b566168..95fe713 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 '<span class="warning tabledrag-changed">*</span>';
+ return '<abbr class="warning tabledrag-changed" title="' + Drupal.t('Changed') + '">*</abbr>';
};
Drupal.theme.prototype.tableDragIndentation = function () {
diff --git a/modules/field/field.form.inc b/modules/field/field.form.inc
index 66d93e9..9250a51 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']) ? '<span class="form-required" title="' . t('This field is required. ') . '">*</span>' : '';
+ $required = !empty($element['#required']) ? '<abbr class="form-required" title="' . t('This field is required. ') . '">*</abbr>' : '';
$header = array(
array(
diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test
index e7ae9de..4d96929 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 = '@<label.*<span class="form-required" title="This field is required\.">\*</span></label>@';
+ $required_marker_preg = '@<label.*<abbr class="form-required" title="This field is required\.">\*</abbr></label>@';
// 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 d8dbc51..f34a965 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 f36fa96..4a5961c 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;
}