Bug #45512

Make the type attribute optional on script, style and link elements

Added by Ian Devlin over 8 years ago. Updated 6 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2013-02-15
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

With HTML5, the type attribute is no longer required on script, style and link[rel="stylesheet"] elements, as they automatically default to "text/javascript" and "text/css" (x2) respectively.

It should be possible to configure this via TypoScript.


Related issues

Related to TYPO3 Core - Feature #47857: Delete adding type="text/javascript" if doctype is HTML5ClosedPatrick Broens2013-05-03

Actions
Related to scriptmerger - Feature #38176: Add a conditon on the doctypeClosed2012-06-19

Actions
Related to TYPO3 Core - Feature #11287: Fluid section for header codeClosed2010-12-05

Actions
Related to TYPO3 Core - Task #83633: The type attribute is unnecessary for JavaScript resources.Closed2018-01-22

Actions
Related to TYPO3 Core - Bug #85053: Page Validation WarningClosed2018-05-21

Actions
Related to TYPO3 Core - Feature #86759: nomodule attribute on script tagClosed2018-10-26

Actions
Related to TYPO3 Core - Bug #88316: Do not set type attribute by default in script tag for page.includeJS (HTML5 compliance)Closed2019-05-09

Actions
Related to TYPO3 Core - Feature #88772: Omit type=text/javascript in HTML5 script tagsClosedBenni Mack2019-07-15

Actions
Related to TYPO3 Core - Bug #92126: Still <script type="text/javascript" ... hardcoded in PageRenderer.php -> leads to validity warningClosed2020-08-28

Actions
#1

Updated by Patrick Broens over 8 years ago

  • Complexity set to easy

This can simply be checked by using config.doctype = html5. We have to be aware that "type" can be set to a different value. I agree it can be removed when it is using the default value of text/javascript. Same for link tag and the style attribute.

#2

Updated by Mathias Schreiber over 6 years ago

  • Target version set to 7.2 (Frontend)
  • Is Regression set to No
#3

Updated by Benni Mack almost 6 years ago

  • Target version changed from 7.2 (Frontend) to 7.4 (Backend)
#4

Updated by Susanne Moog almost 6 years ago

  • Target version changed from 7.4 (Backend) to 7.5
#5

Updated by Benni Mack over 5 years ago

  • Target version changed from 7.5 to 7 LTS
#6

Updated by Mathias Schreiber over 5 years ago

  • Target version deleted (7 LTS)
#7

Updated by Riccardo De Contardi over 5 years ago

  • Status changed from New to Accepted
#8

Updated by Gerrit Code Review almost 5 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49500

#9

Updated by Gerrit Code Review almost 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49500

#10

Updated by David Bruchmann almost 4 years ago

Even not required after this issue is solved the type for javascript is now "application/javascript" and "text/javascript" is obsolet.

#11

Updated by Oliver Hader over 3 years ago

  • Category changed from 1050 to Frontend
#12

Updated by Wittkiel Gruppe over 3 years ago

Would be nice for 8 and 9 LTS, because since ~December 2017 W3C-Validator shows a warning, for example:

Warning: The type attribute is unnecessary for JavaScript resources.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js" type="text/javascript"></script>

See https://github.com/validator/validator/issues/560

#13

Updated by Riccardo De Contardi over 3 years ago

  • Related to Task #83633: The type attribute is unnecessary for JavaScript resources. added
#14

Updated by Riccardo De Contardi over 3 years ago

I add here my two cents:

I wonder if it would be better to remove the attribute at all instead of making it optional with a condition on doctype, and let people add it explicitly; something similar to the "meta" (https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Meta/Index.html#meta) like:

includeJS {
  file1 = fileadmin/helloworld.js
  file1.attribute.type = text/javascript
}
#15

Updated by Riccardo De Contardi about 3 years ago

  • Related to Bug #85053: Page Validation Warning added
#16

Updated by Martin Weymayer over 2 years ago

  • TYPO3 Version changed from 6.0 to 9

seems this "bug" is in 9.5??

#17

Updated by Susanne Moog over 2 years ago

  • Status changed from Under Review to Accepted

Review was abandoned.

#18

Updated by Benni Mack about 2 years ago

We need the attribute, to also do stuff like "type=module" https://caniuse.com/#feat=es6-module

#19

Updated by Benni Mack about 2 years ago

#20

Updated by Riccardo De Contardi about 2 years ago

  • Related to Bug #88316: Do not set type attribute by default in script tag for page.includeJS (HTML5 compliance) added
#21

Updated by Riccardo De Contardi almost 2 years ago

  • Related to Feature #88772: Omit type=text/javascript in HTML5 script tags added
#22

Updated by Georg Ringer almost 2 years ago

  • Status changed from Accepted to Closed

resolved with #88772 therefore I am closing this issue

#23

Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Closed to Accepted

I re-open this one; the part about style and link tags are still missing

#24

Updated by Gerrit Code Review 9 months ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65548

#25

Updated by Gerrit Code Review 9 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65548

#26

Updated by Gerrit Code Review 9 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65548

#27

Updated by Gerrit Code Review 8 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65548

#28

Updated by Riccardo De Contardi 8 months ago

  • Related to Bug #92126: Still <script type="text/javascript" ... hardcoded in PageRenderer.php -> leads to validity warning added
#29

Updated by Gerrit Code Review 7 months ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65548

#30

Updated by Gerrit Code Review 7 months ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65548

#31

Updated by Gerrit Code Review 7 months ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65548

#32

Updated by Gerrit Code Review 7 months ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65548

#33

Updated by Benni Mack 7 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#34

Updated by Benni Mack 6 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF