#31892 closed Cleanup/optimization (fixed)
Added release notes about removing "type" attribute from rendered <script>'s.
| Reported by: | Buky | Owned by: | Jon Dufresne |
|---|---|---|---|
| Component: | Documentation | Version: | 3.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hi,
For Django in 3.0 and before when Media is used (forms.widgets.py), the method render_js will produce:
<script type="text/javascript" src="file.js"></script>
but in Django 3.1 we get:
<script src="file.js"></script>
This change is uncovered in Django 3.1 release notes (https://docs.djangoproject.com/en/3.1/releases/3.1/). Does it a regression?
Media.render_js before Django 3.1:
def render_js(self):
return [
format_html(
'<script type="text/javascript" src="{}"></script>',
self.absolute_path(path)
) for path in self._js
]
Change History (9)
comment:1 by , 5 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 5 years ago
comment:3 by , 5 years ago
it's just breaking news tests in django-pipeline and I don't find any information about this in the release notes
Thank you for the quick answer, I will do what is necessary to update the package
comment:4 by , 5 years ago
| Has patch: | set |
|---|
I'm open to including a mention in release notes. Here is a go at that: https://github.com/django/django/pull/13312
Let me know if that would have helped.
comment:5 by , 5 years ago
Great idea. That will be useful for other packages who deal with statistics.
comment:6 by , 5 years ago
| Summary: | [Regression][Widgets][Media] render_js → [Undocumented][Widgets][Media] render_js |
|---|
comment:7 by , 5 years ago
| Component: | Forms → Documentation |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
| Summary: | [Undocumented][Widgets][Media] render_js → Added release notes about removing "type" attribute from rendered <script>'s. |
| Triage Stage: | Unreviewed → Accepted |
| Type: | Uncategorized → Cleanup/optimization |
This behavior intentionally changed in e703b93a656b78b9b444bb3a9980e305ed002a70 for ticket #31080. As noted in that ticket, specifying the default type is not recommend.
From https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-type
From https://html.spec.whatwg.org/multipage/scripting.html#the-script-element
Beyond simply being different, how is this causing an issue in practice?
If there is no practical issue then I think we should stick with the smaller, simplified form recommended by upstream authorities.