diff --git a/core/modules/block_content/js/block_content.js b/core/modules/block_content/js/block_content.js index c5c79ee..8ce1e65 100644 --- a/core/modules/block_content/js/block_content.js +++ b/core/modules/block_content/js/block_content.js @@ -23,14 +23,13 @@ var $context = $(context); $context.find('.block-content-form-revision-information').drupalSetSummary(function (context) { var $revisionContext = $(context); - var revisionCheckbox = $revisionContext.find('.form-item-revision input'); - - // Return 'New revision' if the 'Create new revision' checkbox is - // checked, or if the checkbox doesn't exist, but the revision log does. - // For users without the "Administer content" permission the checkbox - // won't appear, but the revision log will if the content type is set - // to auto-revision. - if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $revisionContext.find('.form-item-revision-log textarea').length)) { + var revisionCheckbox = $revisionContext.find('.js-form-item-revision input'); + + // Return 'New revision' if the 'Create new revision' checkbox is checked, + // or if the checkbox doesn't exist, but the revision log does. For users + // without the "Administer content" permission the checkbox won't appear, + // but the revision log will if the content type is set to auto-revision. + if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $revisionContext.find('.js-form-item-revision-log textarea').length)) { return Drupal.t('New revision'); } @@ -40,13 +39,13 @@ $context.find('fieldset.block-content-translation-options').drupalSetSummary(function (context) { var $translationContext = $(context); var translate; - var $checkbox = $translationContext.find('.form-item-translation-translate input'); + var $checkbox = $translationContext.find('.js-form-item-translation-translate input'); if ($checkbox.size()) { translate = $checkbox.is(':checked') ? Drupal.t('Needs to be updated') : Drupal.t('Does not need to be updated'); } else { - $checkbox = $translationContext.find('.form-item-translation-retranslate input'); + $checkbox = $translationContext.find('.js-form-item-translation-retranslate input'); translate = $checkbox.is(':checked') ? Drupal.t('Flag other translations as outdated') : Drupal.t('Do not flag other translations as outdated'); } diff --git a/core/modules/ckeditor/js/ckeditor.admin.js b/core/modules/ckeditor/js/ckeditor.admin.js index ad165bf..30b3dc2 100644 --- a/core/modules/ckeditor/js/ckeditor.admin.js +++ b/core/modules/ckeditor/js/ckeditor.admin.js @@ -25,9 +25,9 @@ var $configurationForm = $(context).find('.ckeditor-toolbar-configuration').once('ckeditor-configuration'); if ($configurationForm.length) { var $textarea = $configurationForm - // Hide the textarea that contains the serialized representation of - // the CKEditor configuration. - .find('.form-item-editor-settings-toolbar-button-groups') + // Hide the textarea that contains the serialized representation of the + // CKEditor configuration. + .find('.js-form-item-editor-settings-toolbar-button-groups') .hide() // Return the textarea child node from this expression. .find('textarea'); diff --git a/core/modules/comment/comment-entity-form.js b/core/modules/comment/comment-entity-form.js index 9e90979..3cdf08c 100644 --- a/core/modules/comment/comment-entity-form.js +++ b/core/modules/comment/comment-entity-form.js @@ -15,7 +15,7 @@ attach: function (context) { var $context = $(context); $context.find('fieldset.comment-entity-settings-form').drupalSetSummary(function (context) { - return Drupal.checkPlain($(context).find('.form-item-comment input:checked').next('label').text()); + return Drupal.checkPlain($(context).find('.js-form-item-comment input:checked').next('label').text()); }); } }; diff --git a/core/modules/field_ui/field_ui.js b/core/modules/field_ui/field_ui.js index 948882f..9f1afc6 100644 --- a/core/modules/field_ui/field_ui.js +++ b/core/modules/field_ui/field_ui.js @@ -23,9 +23,9 @@ // submitted at the same time. The actual validation will happen // server-side. $form.find( - '.form-item-label label,' + - '.form-item-field-name label,' + - '.form-item-existing-storage-label label') + '.js-form-item-label label,' + + '.js-form-item-field-name label,' + + '.js-form-item-existing-storage-label label') .addClass('js-form-required form-required'); var $newFieldType = $form.find('select[name="new_storage_type"]'); diff --git a/core/modules/language/config/optional/tour.tour.language.yml b/core/modules/language/config/optional/tour.tour.language.yml index 7cca3e5..ffc855d 100644 --- a/core/modules/language/config/optional/tour.tour.language.yml +++ b/core/modules/language/config/optional/tour.tour.language.yml @@ -34,7 +34,7 @@ tips: body: '

You can change the default language of the site by choosing one of your configured languages as default. The site will use the default language in situations where no choice is made but a language should be set, for example as the language of the displayed interface.

' weight: 4 attributes: - data-class: form-item-site-default-language + data-class: js-form-item-site-default-language language-operations: id: language-operations plugin: text diff --git a/core/modules/menu_ui/menu_ui.js b/core/modules/menu_ui/menu_ui.js index 54518c0..aca9f61 100644 --- a/core/modules/menu_ui/menu_ui.js +++ b/core/modules/menu_ui/menu_ui.js @@ -19,8 +19,8 @@ attach: function (context) { $(context).find('.menu-link-form').drupalSetSummary(function (context) { var $context = $(context); - if ($context.find('.form-item-menu-enabled input').is(':checked')) { - return Drupal.checkPlain($context.find('.form-item-menu-title input').val()); + if ($context.find('.js-form-item-menu-enabled input').is(':checked')) { + return Drupal.checkPlain($context.find('.js-form-item-menu-title input').val()); } else { return Drupal.t('Not in menu'); @@ -46,9 +46,9 @@ // Try to find menu settings widget elements as well as a 'title' field // in the form, but play nicely with user permissions and form // alterations. - var $checkbox = $this.find('.form-item-menu-enabled input'); - var $link_title = $context.find('.form-item-menu-title input'); - var $title = $this.closest('form').find('.form-item-title-0-value input'); + var $checkbox = $this.find('.js-form-item-menu-enabled input'); + var $link_title = $context.find('.js-form-item-menu-title input'); + var $title = $this.closest('form').find('.js-form-item-title-0-value input'); // Bail out if we do not have all required fields. if (!($checkbox.length && $link_title.length && $title.length)) { return; diff --git a/core/modules/node/content_types.js b/core/modules/node/content_types.js index 068555d..912bdc9 100644 --- a/core/modules/node/content_types.js +++ b/core/modules/node/content_types.js @@ -37,7 +37,7 @@ $('#edit-language', context).drupalSetSummary(function (context) { var vals = []; - vals.push($(".form-item-language-configuration-langcode select option:selected", context).text()); + vals.push($(".js-form-item-language-configuration-langcode select option:selected", context).text()); $('input:checked', context).next('label').each(function () { vals.push(Drupal.checkPlain($(this).text())); diff --git a/core/modules/node/node.js b/core/modules/node/node.js index 5dcdc05..c1244c8 100644 --- a/core/modules/node/node.js +++ b/core/modules/node/node.js @@ -20,14 +20,14 @@ var $context = $(context); $context.find('.node-form-revision-information').drupalSetSummary(function (context) { var $revisionContext = $(context); - var revisionCheckbox = $revisionContext.find('.form-item-revision input'); + var revisionCheckbox = $revisionContext.find('.js-form-item-revision input'); - // Return 'New revision' if the 'Create new revision' checkbox is - // checked, or if the checkbox doesn't exist, but the revision log does. - // For users without the "Administer content" permission the checkbox - // won't appear, but the revision log will if the content type is set to - // auto-revision. - if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $revisionContext.find('.form-item-revision-log textarea').length)) { + // Return 'New revision' if the 'Create new revision' checkbox is + // checked, or if the checkbox doesn't exist, but the revision log does. + // For users without the "Administer content" permission the checkbox + // won't appear, but the revision log will if the content type is set to + // auto-revision. + if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $revisionContext.find('.js-form-item-revision-log textarea').length)) { return Drupal.t('New revision'); } @@ -61,13 +61,13 @@ $context.find('fieldset.node-translation-options').drupalSetSummary(function (context) { var $translationContext = $(context); var translate; - var $checkbox = $translationContext.find('.form-item-translation-translate input'); + var $checkbox = $translationContext.find('.js-form-item-translation-translate input'); if ($checkbox.size()) { translate = $checkbox.is(':checked') ? Drupal.t('Needs to be updated') : Drupal.t('Does not need to be updated'); } else { - $checkbox = $translationContext.find('.form-item-translation-retranslate input'); + $checkbox = $translationContext.find('.js-form-item-translation-retranslate input'); translate = $checkbox.is(':checked') ? Drupal.t('Flag other translations as outdated') : Drupal.t('Do not flag other translations as outdated'); } diff --git a/core/modules/path/path.js b/core/modules/path/path.js index 93bdd90..2a7f48c 100644 --- a/core/modules/path/path.js +++ b/core/modules/path/path.js @@ -17,7 +17,7 @@ Drupal.behaviors.pathDetailsSummaries = { attach: function (context) { $(context).find('.path-form').drupalSetSummary(function (context) { - var path = $('.form-item-path-0-alias input').val(); + var path = $('.js-form-item-path-0-alias input').val(); return path ? Drupal.t('Alias: @alias', {'@alias': path}) : diff --git a/core/modules/system/src/Tests/Form/ElementsLabelsTest.php b/core/modules/system/src/Tests/Form/ElementsLabelsTest.php index 48700b8..9a09442 100644 --- a/core/modules/system/src/Tests/Form/ElementsLabelsTest.php +++ b/core/modules/system/src/Tests/Form/ElementsLabelsTest.php @@ -71,7 +71,7 @@ function testFormLabels() { $elements = $this->xpath('//label[@for="edit-form-textfield-test-title-no-show"]'); $this->assertFalse(isset($elements[0]), 'No label tag when title set not to display.'); - $elements = $this->xpath('//div[contains(@class, "form-item-form-textfield-test-title-invisible") and contains(@class, "form-no-label")]'); + $elements = $this->xpath('//div[contains(@class, "js-form-item-form-textfield-test-title-invisible") and contains(@class, "form-no-label")]'); $this->assertTrue(isset($elements[0]), 'Field class is form-no-label when there is no label.'); // Check #field_prefix and #field_suffix placement. @@ -82,10 +82,10 @@ function testFormLabels() { $this->assertTrue(isset($elements[0]), 'Properly places the #field_suffix element immediately after the form field.'); // Check #prefix and #suffix placement. - $elements = $this->xpath('//div[@id="form-test-textfield-title-prefix"]/following-sibling::div[contains(@class, \'form-item-form-textfield-test-title\')]'); + $elements = $this->xpath('//div[@id="form-test-textfield-title-prefix"]/following-sibling::div[contains(@class, \'js-form-item-form-textfield-test-title\')]'); $this->assertTrue(isset($elements[0]), 'Properly places the #prefix element before the form item.'); - $elements = $this->xpath('//div[@id="form-test-textfield-title-suffix"]/preceding-sibling::div[contains(@class, \'form-item-form-textfield-test-title\')]'); + $elements = $this->xpath('//div[@id="form-test-textfield-title-suffix"]/preceding-sibling::div[contains(@class, \'js-form-item-form-textfield-test-title\')]'); $this->assertTrue(isset($elements[0]), 'Properly places the #suffix element before the form item.'); // Check title attribute for radios and checkboxes. diff --git a/core/modules/system/src/Tests/Form/RebuildTest.php b/core/modules/system/src/Tests/Form/RebuildTest.php index ddb86ae..7674241 100644 --- a/core/modules/system/src/Tests/Form/RebuildTest.php +++ b/core/modules/system/src/Tests/Form/RebuildTest.php @@ -109,7 +109,7 @@ function testPreserveFormActionAfterAJAX() { // Ensure that the form contains two items in the multi-valued field, so we // know we're testing a form that was correctly retrieved from cache. - $this->assert(count($this->xpath('//form[contains(@id, "node-page-form")]//div[contains(@class, "form-item-field-ajax-test")]//input[@type="text"]')) == 2, 'Form retained its state from cache.'); + $this->assert(count($this->xpath('//form[contains(@id, "node-page-form")]//div[contains(@class, "js-form-item-field-ajax-test")]//input[@type="text"]')) == 2, 'Form retained its state from cache.'); // Ensure that the form's action is correct. $forms = $this->xpath('//form[contains(@class, "node-page-form")]'); diff --git a/core/modules/system/src/Tests/System/ThemeTest.php b/core/modules/system/src/Tests/System/ThemeTest.php index f4e87e1..0a0d93a 100644 --- a/core/modules/system/src/Tests/System/ThemeTest.php +++ b/core/modules/system/src/Tests/System/ThemeTest.php @@ -96,7 +96,7 @@ function testThemeSettings() { // Verify logo path examples. $elements = $this->xpath('//div[contains(@class, :item)]/div[@class=:description]/code', array( - ':item' => 'form-item-logo-path', + ':item' => 'js-form-item-logo-path', ':description' => 'description', )); // Expected default values (if all else fails). diff --git a/core/modules/system/templates/form-element.html.twig b/core/modules/system/templates/form-element.html.twig index 9292fd7..082df34 100644 --- a/core/modules/system/templates/form-element.html.twig +++ b/core/modules/system/templates/form-element.html.twig @@ -50,7 +50,8 @@ set classes = [ 'form-item', 'js-form-type-' ~ type|clean_class, - 'form-item-' ~ name|clean_class, + 'form-item' ~ name|clean_class, + 'js-form-item-' ~ name|clean_class, title_display not in ['after', 'before'] ? 'form-no-label', disabled == 'disabled' ? 'form-disabled', errors ? 'form-item--error', diff --git a/core/modules/views_ui/js/views-admin.js b/core/modules/views_ui/js/views-admin.js index f47f270..bda963b 100644 --- a/core/modules/views_ui/js/views-admin.js +++ b/core/modules/views_ui/js/views-admin.js @@ -601,7 +601,7 @@ } var $context = $(context); var $table = $context.find('#views-rearrange-filters').once('views-rearrange-filters'); - var $operator = $context.find('.form-item-filter-groups-operator').once('views-rearrange-filters'); + var $operator = $context.find('.js-form-item-filter-groups-operator').once('views-rearrange-filters'); if ($table.length) { new Drupal.viewsUi.RearrangeFilterHandler($table, $operator); } @@ -1004,9 +1004,9 @@ attach: function (context) { var $context = $(context); - var $selectAll = $context.find('.form-item-options-value-all').once('filterConfigSelectAll'); + var $selectAll = $context.find('.js-form-item-options-value-all').once('filterConfigSelectAll'); var $selectAllCheckbox = $selectAll.find('input[type=checkbox]'); - var $checkboxes = $selectAll.closest('.form-checkboxes').find('.js-form-type-checkbox:not(.form-item-options-value-all) input[type="checkbox"]'); + var $checkboxes = $selectAll.closest('.form-checkboxes').find('.js-form-type-checkbox:not(.js-form-item-options-value-all) input[type="checkbox"]'); if ($selectAll.length) { // Show the select all checkbox. diff --git a/core/themes/classy/templates/form/form-element.html.twig b/core/themes/classy/templates/form/form-element.html.twig index 65028fa..d33b094 100644 --- a/core/themes/classy/templates/form/form-element.html.twig +++ b/core/themes/classy/templates/form/form-element.html.twig @@ -49,6 +49,7 @@ 'form-item', 'js-form-type-' ~ type|clean_class, 'form-type-' ~ type|clean_class, + 'js-form-item-' ~ name|clean_class, 'form-item-' ~ name|clean_class, title_display not in ['after', 'before'] ? 'form-no-label', disabled == 'disabled' ? 'form-disabled',