Opened 4 months ago

Last modified 4 months ago

#36353 closed New feature

Add `content` to `Script` media asset — at Version 1

Reported by: Johannes Maron Owned by:
Component: Forms Version: 5.2
Severity: Normal Keywords:
Cc: Johannes Maron Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Johannes Maron)

This is a follow-up to #35886

I noticed that the Script does support any attribute, but not a content or innerHTML.

Currently:

element_template = '<script src="{path}"{attributes}></script>'

Better:

element_template = '<script{attributes}>{content}</script>'

You might want to just drop a import "#myPackage" inside the script tag, to lead a file from your importmap.

This would look something like:

Script(type="module", content="import 'myPackage'")

Change History (1)

comment:1 by Johannes Maron, 4 months ago

Description: modified (diff)
Type: Cleanup/optimizationNew feature
Note: See TracTickets for help on using tickets.
Back to Top