#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
--------------------------------+--------------------------------------
Changes (by Johannes Maron):

 * type:  Cleanup/optimization => New feature


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 src="{path}"{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'")
> }}}
>

> I am not sure, if this is a bug, feature request or cleanup, someone
> should review the ticket type.

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'")
 }}}

--
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36353#comment:1>
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/010701966ed1db97-2d7c0908-e9f5-4090-9aba-bccdc0d47d63-000000%40eu-central-1.amazonses.com.

Reply via email to