#36353: Add `content` to `Script` media asset
--------------------------------+--------------------------------------
Reporter: Johannes Maron | Owner: (none)
Type: New feature | Status: new
Component: Forms | Version: 5.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Description changed by Johannes Maron:
Old description:
> 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'")
> }}}
New description:
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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/36353#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701966ed8a505-e17a5c2c-4e29-44e9-a5c4-2a5682f5c10a-000000%40eu-central-1.amazonses.com.