Opened 4 months ago
Last modified 4 months ago
#36353 closed New feature
Add `content` to `Script` media asset — at Version 2
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 )
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'")
This is going to complicate the path-based sorting I implemented back in the day. But I believe the path
can be swapped for content
without much trouble.
Change History (2)
comment:1 by , 4 months ago
Description: | modified (diff) |
---|---|
Type: | Cleanup/optimization → New feature |
comment:2 by , 4 months ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.