Follow-up to #2473947: Prefix form-item-* classes with js-
Problem/Motivation
In #2473947: Prefix form-item-* classes with js- we identified files with Javascript code that is no longer used because of #1838114: Change node form’s vertical tabs into details elements.
core/modules/comment/comment-entity-form.js
core/modules/menu_ui/menu_ui.js
core/modules/node/node.js
core/modules/path/path.js
core/modules/views_ui/js/views-admin.js
The common thread in all of these files is drupalSetSummary()
. Looking for this function in HEAD, I found additional files that should be checked:
ag drupalSetSummary core/modules/
core/modules/block/block.js
10: // The drupalSetSummary method required for this behavior is not available
12: // behavior is processed only if drupalSetSummary is defined.
13: if (typeof jQuery.fn.drupalSetSummary === 'undefined') {
29: $('#edit-visibility-node-type').drupalSetSummary(checkboxesSummary);
30: $('#edit-visibility-language').drupalSetSummary(checkboxesSummary);
31: $('#edit-visibility-role').drupalSetSummary(checkboxesSummary);
33: $('#edit-visibility-path').drupalSetSummary(function (context) {
core/modules/book/book.js
12: $(context).find('.book-outline-form').drupalSetSummary(function (context) {
core/modules/comment/comment-node-form.js
13: $context.find('.comment-node-settings-form').drupalSetSummary(function (context) {
18: $context.find('.comment-node-type-settings-form').drupalSetSummary(function(context) {
core/modules/filter/filter.admin.js
41: tab.details.drupalSetSummary(function (tabContext) {
core/modules/menu/menu.js
7: $(context).find('.menu-link-form').drupalSetSummary(function (context) {
core/modules/node/content_types.js
14: $context.find('#edit-submission').drupalSetSummary(function(context) {
19: $context.find('#edit-workflow').drupalSetSummary(function(context) {
29: $('#edit-language', context).drupalSetSummary(function(context) {
40: $context.find('#edit-display').drupalSetSummary(function(context) {
core/modules/node/node.js
13: $context.find('.node-form-revision-information').drupalSetSummary(function (context) {
28: $context.find('.node-form-author').drupalSetSummary(function (context) {
37: $context.find('.node-form-options').drupalSetSummary(function (context) {
51: $context.find('fieldset.node-translation-options').drupalSetSummary(function (context) {
core/modules/path/path.js
11: $(context).find('.path-form').drupalSetSummary(function (context) {
Proposed resolution
Go through these files and removed unused JS functions. In cases where that is the only thing, remove the file.
Candidate files:
- core/modules/comment/comment-entity-form.js
- core/modules/block/block.js
- core/modules/book/book.js
- core/modules/comment/comment-node-form.js
- core/modules/filter/filter.admin.js
- core/modules/menu/menu.js
- core/modules/menu_ui/menu_ui.js
- core/modules/node/content_types.js
- core/modules/node/node.js
- core/modules/path/path.js
- core/modules/views_ui/js/views-admin.js
Comments
Comment #1
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedI am tagging it SafeMarkup because some of the files have
SafeMarkup::set
in them.Comment #2
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedComment #3
nod_The thing is that we don't want to remove the summaries, they got broken along the way, I would love to remove that much JS but it's JS that should be used really.
The way to fix this is more #2493957: Add back errors support to native HTML5 details tag than straight removal.
Comment #4
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedAdded reference to #2493957: Add back errors support to native HTML5 details tag
Comment #5
alimac CreditAttribution: alimac at University of Illinois at Chicago commentedComment #6
YesCT CreditAttribution: YesCT commentedok. well... if we are going to use it, then we probably do not have to (should not?) remove it. so closing this issue and we should move to working on #2493957: Add back errors support to native HTML5 details tag.
Comment #7
Chi CreditAttribution: Chi commentedThis should be noted here. Since #1838114: Change node form’s vertical tabs into details elements affected only Seven theme those referenced files are still used. The simplest way to check it is setting Bartik as an administrative theme.