task: drop text/javascript from <script> tags

Created on 29 November 2019, over 4 years ago
Updated 14 August 2023, 11 months ago

Also see D7 Remove type="text/javascript" from Closed: works as designed

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇸🇰Slovakia poker10

    Would this change cause issues in case someone is using the module on XHTML, not HTML5? Because in XHTML the type attribute is required.

  • I did some research on the standards. As poker10 pointed out, XHTML requires the type attribute on script tags. HTML5 says type should be omitted for JavaScript, although it is still allowed. W3C indicates that the XHTML recommendation has been superseded and links to HTML5.

    Our site uses XHTML so I held off on the advagg 7.x-2.36 update but since there haven’t been any comments, I eventually tried installing it. It did remove the type attributes yet the site continues to work just as before. Maybe the browsers are still lenient even though I read XML syntax was supposed to be strict. Technically it’s generating invalid XHTML. It seems that the pages work anyway.

    Twelve lines above this change it’s adding almost twice as many characters as this saves to be compatible with XHTML and HTML4, so if compatibility is the intent it seems like this type should be put back. Maybe there could be a configuration option or automatic detection to only remove the type on HTML5 pages, although removing it is such a small savings it hardly seems worth it unless it’s causing HTML5 sites to fail some kind of validation.

    Since updates are infrequent, I think I’ll just edit my copy of advagg.module for now to undo this patch after each update, unless this is changed. It doesn’t seem to be causing any harm but why not keep the XHTML valid when it’s that easy.

  • 🇸🇰Slovakia poker10

    Thanks for looking at this more closely @JerryACSA!

    I have created a separate issue 🐛 text/javascript missing in Active , where we can disucuss the next steps (and probably reverting the change).

Production build 0.69.0 2024