Opened 3 months ago

Closed 3 months ago

#35195 closed Cleanup/optimization (fixed)

Remove type="text/css" from <style>.

Reported by: Cosmic Process Owned by: Cosmic Process
Component: Core (Other) Version: 5.0
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The attribute type="text/css" is unnecessary for <style> and <link> tags in modern HTML. While the commit https://github.com/django/django/commit/7c4f3965098baad2396e24501e09237425a7bd6f removed many type="text/css" attributes, there are still some of them.

$ git grep 'type="text/css"'
django/contrib/admindocs/templates/admin_doc/model_detail.html:<style type="text/css">
django/views/templates/csrf_403.html:  <style type="text/css">
django/views/templates/technical_404.html:  <style type="text/css">
django/views/templates/technical_500.html:  <style type="text/css">
docs/releases/4.1.txt:* The ``type="text/css"`` attribute is no longer included in ``<link>`` tags
tests/utils_tests/files/strip_tags1.html:    <link href="https://a248.e.akamai.net/assets.github.com/assets/github-f70e4783e00fd4884a9e5e651a43933c9881caa8.css" media="all" rel="stylesheet" type="text/css" />
tests/utils_tests/files/strip_tags1.html:    <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-0d31290d073dea4d8671e2b8c747629aeb074034.css" media="all" rel="stylesheet" type="text/css" />

Change History (7)

in reply to:  description comment:1 by Mariusz Felisiak, 3 months ago

Component: UncategorizedCore (Other)
Summary: Remove all type="text/css" attributesRemove type="text/css" from <style>.
Triage Stage: UnreviewedAccepted

Replying to cosmicproc:

The attribute type="text/css" is unnecessary for <style> and <link> tags in modern HTML. While the commit https://github.com/django/django/commit/7c4f3965098baad2396e24501e09237425a7bd6f removed many type="text/css" attributes, there are still some of them.

$ git grep 'type="text/css"'
django/contrib/admindocs/templates/admin_doc/model_detail.html:<style type="text/css">
django/views/templates/csrf_403.html:  <style type="text/css">
django/views/templates/technical_404.html:  <style type="text/css">
django/views/templates/technical_500.html:  <style type="text/css">
docs/releases/4.1.txt:* The ``type="text/css"`` attribute is no longer included in ``<link>`` tags
tests/utils_tests/files/strip_tags1.html:    <link href="https://a248.e.akamai.net/assets.github.com/assets/github-f70e4783e00fd4884a9e5e651a43933c9881caa8.css" media="all" rel="stylesheet" type="text/css" />
tests/utils_tests/files/strip_tags1.html:    <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-0d31290d073dea4d8671e2b8c747629aeb074034.css" media="all" rel="stylesheet" type="text/css" />

Removing text/css from release notes and tests would be incorrect, so only these 4 cases are valid:

django/contrib/admindocs/templates/admin_doc/model_detail.html:<style type="text/css">
django/views/templates/csrf_403.html:  <style type="text/css">
django/views/templates/technical_404.html:  <style type="text/css">
django/views/templates/technical_500.html:  <style type="text/css">

Would you like to prepare a patch?

comment:2 by Cosmic Process, 3 months ago

Sure. I didn't mean all of them anyway. I wanted to keep the output of the command intact.

comment:3 by Cosmic Process, 3 months ago

Owner: changed from nobody to Cosmic Process
Status: newassigned

comment:4 by Cosmic Process, 3 months ago

comment:5 by Cosmic Process, 3 months ago

Has patch: set

comment:6 by Mariusz Felisiak, 3 months ago

Triage Stage: AcceptedReady for checkin

comment:7 by GitHub <noreply@…>, 3 months ago

Resolution: fixed
Status: assignedclosed

In c783e7a:

Fixed #35195 -- Removed unnecessary type="text/css" attributes from <style> tags.

Note: See TracTickets for help on using tickets.
Back to Top