Problem/Motivation
Since 3.5, CustomElement::setSlotFromRenderArray() adds a <drupal-library-*> element for every JavaScript library a render array attaches. Sites whose frontend does not load Drupal's JavaScript get a larger payload and unknown elements, and cannot turn this off.
Proposed resolution
Add a boolean library_elements to custom_elements.settings, off by default, and emit library elements only when it is on.
Remaining tasks
- Review.
User interface changes
A checkbox in the Custom Elements settings form.
Data model changes
New configuration key library_elements, with an update for existing sites.
AI disclosure
This issue and the patch were drafted with AI assistance (Claude Code). I reviewed and tested the change before posting.
Issue fork custom_elements-3638044
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
fagoComment #4
fagoComment #5
fagothe MR adds the settings, tested and reviewed, all good!
Comment #6
fagoThis also adds docs for the feature in README. I improved it a bit. all good now.
Comment #8
fagomerged.