The following three libraries are loaded for even a very simple webform. In the case I found it was the front page of Byte which is the new Drupal CMS site template.
webform.element.details.save:
js:
js/webform.element.details.save.js: {}
dependencies:
- core/drupal
- core/jquery
- core/once
webform.element.details.toggle:
css:
component:
css/webform.element.details.toggle.css: {}
js:
js/webform.element.details.toggle.js: {}
dependencies:
- core/drupal
- core/drupal.announce
- core/jquery
- core/once
Because the libraries depend on jQuery, this means that an anonymous front page request on Byte is loading jQuery - however the form itself is an e-mail field and a submit button - it seems likely the JavaScript isn't actually used at all in this context. So if it's possible to avoid loading those libraries, it would allow over 70+kb of js to be saved from Drupal CMS's default recipe's front page.
Looks like at least one place resulting in this is:
hook_form_alter()
// Add details 'toggle all' to all webforms (except submission forms).
if (!$form_object instanceof WebformSubmissionForm) {
$form['#attributes']['class'][] = 'js-webform-details-toggle';
$form['#attributes']['class'][] = 'webform-details-toggle';
$form['#attached']['library'][] = 'webform/webform.element.details.toggle';
return;
}
There doesn't seem to be a way to prevent this library being added at all.
Active
6.3
Code
It affects performance. It is often combined with the Needs profiling tag.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.