Opened 6 weeks ago

Last modified 21 hours ago

#35886 assigned New feature

Move object-based script media assets to the public API

Reported by: Johannes Maron Owned by: Johannes Maron
Component: Forms Version: dev
Severity: Normal Keywords:
Cc: Johannes Maron, Tobias Kunze, David Smith Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

This is a successor to #29490 and a result of the discussion on #22298 and its corresponding forum thread.

This ticket aims to move object-based media assets to the public API and documentation.
A sample implementation has been part of the test suite for years, see also: https://github.com/django/django/blob/97a6a678c406b0049bd17bcd34f1d71d96141994/tests/forms_tests/tests/test_media.py#L717-L771

The goal is to support form assets with modern attributes, like:

<script type="module">
<!-- or -->
<script defer>
<!-- or -->
<script async>

And other standardized attributes, see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script

The same can be done for stylesheets via the link tag, which does support many more attributes than media, see also: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link

Considerations

We could deprecate "string" based assets. This may simplify django.forms since, the CSS grouping wouldn't be needed anymore.

Change History (11)

comment:1 by Sarah Boyce, 6 weeks ago

Cc: Tobias Kunze David Smith added
Triage Stage: UnreviewedAccepted
Type: Cleanup/optimizationNew feature

Accepting based off the forum discussion

comment:2 by Johannes Maron, 6 weeks ago

Owner: set to Johannes Maron
Status: newassigned

comment:3 by Johannes Maron, 6 weeks ago

Has patch: set

comment:4 by Sarah Boyce, 3 weeks ago

Patch needs improvement: set

comment:5 by Johannes Maron, 3 weeks ago

Patch needs improvement: unset

comment:6 by Sarah Boyce, 2 weeks ago

Needs tests: set

comment:7 by Johannes Maron, 8 days ago

Needs tests: unset

comment:8 by Johannes Maron, 6 days ago

Summary: Move object-based media assets to the public APIMove object-based script media assets to the public API
Triage Stage: AcceptedReady for checkin

comment:9 by Sarah Boyce, 6 days ago

Triage Stage: Ready for checkinAccepted

You cannot mark your own ticket as "Ready for checkin"

comment:10 by Johannes Maron, 6 days ago

Sorry 🫣 I should know better

comment:11 by Sarah Boyce, 21 hours ago

Patch needs improvement: set
Note: See TracTickets for help on using tickets.
Back to Top