Opened 4 months ago
Closed 4 months ago
#36353 closed New feature (wontfix)
Add `content` to `Script` media asset
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 (3)
comment:1 by , 4 months ago
Description: | modified (diff) |
---|---|
Type: | Cleanup/optimization → New feature |
comment:2 by , 4 months ago
Description: | modified (diff) |
---|
comment:3 by , 4 months ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Thank you for the ticket
Can you first post this on the forum and confirm from a few others that this is wanted (perhaps some of the folks from the original discussion might have some opinions: https://forum.djangoproject.com/t/rejuvenating-vs-deprecating-form-media/21285)?
If we have a few folks agreeing we can accept the ticket