Bug #45512

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

Added by Ian Devlin almost 6 years ago. Updated 27 days ago.

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

0%

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 HTML5 Closed 2013-05-03
Related to scriptmerger - Feature #38176: Add a conditon on the doctype Closed 2012-06-19
Related to TYPO3 Core - Feature #11287: Fluid section for header code Closed 2010-12-05
Related to TYPO3 Core - Task #83633: The type attribute is unnecessary for JavaScript resources. Closed 2018-01-22
Related to TYPO3 Core - Bug #85053: Page Validation Warning Closed 2018-05-21

History

#1 Updated by Patrick Broens almost 6 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 almost 4 years ago

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

#3 Updated by Benni Mack over 3 years ago

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

#4 Updated by Susanne Moog over 3 years ago

  • Target version changed from 7.4 (Backend) to 7.5

#5 Updated by Benni Mack about 3 years ago

  • Target version changed from 7.5 to 7 LTS

#6 Updated by Mathias Schreiber about 3 years ago

  • Target version deleted (7 LTS)

#7 Updated by Riccardo De Contardi about 3 years ago

  • Status changed from New to Accepted

#8 Updated by Gerrit Code Review over 2 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 over 2 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 over 1 year 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 about 1 year ago

  • Category changed from 1050 to Frontend

#12 Updated by Wittkiel Gruppe 11 months 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 11 months ago

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

#14 Updated by Riccardo De Contardi 9 months 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 7 months ago

  • Related to Bug #85053: Page Validation Warning added

#16 Updated by Martin Weymayer 27 days ago

  • TYPO3 Version changed from 6.0 to 9

seems this "bug" is in 9.5??

Also available in: Atom PDF