Bug 20053

Summary: Drop type attribute "text/javascript" for `<script>` elements used in OPAC templates
Product: Koha Reporter: Indranil Das Gupta <indradg>
Component: OPACAssignee: Indranil Das Gupta <indradg>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, julian.maurice, martin.renvoize, nick
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20054
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20066
Change sponsored?: --- Patch complexity: Large patch
Who signed the patch off: Text to go in the release notes:
Prevents warnings about type attribute being generated for `<script>` elements when testing the OPAC pages using W3C Validator for HTML5.
Version(s) released in:
Bug Depends on:    
Bug Blocks: 20066    
Attachments: Bug 20053 - Drop type attribute "text/javascript" in OPAC templates
Bug 20053: Drop type attribute "text/javascript" in OPAC templates
Bug 20053: Drop type attribute "text/javascript" in OPAC templates
Bug 20053: (QA follow-up) Also drop language attribute in OPAC templates
Bug 20053: Drop type attribute "text/javascript" in OPAC templates
Bug 20053: Drop type attribute "text/javascript" in OPAC templates
Bug 20053: Drop type attribute "text/javascript" in OPAC templates

Description Indranil Das Gupta 2018-01-21 17:08:50 UTC
If you run the Koha OPAC pages through the W3C validator it generates warnings about type attribute "text/javascript", since W3C now officially describes this as obsolete in HTML5 but still conforming to the standard with warnings [1]

Since we are already pumping up HTML5 with <!DOCTYPE html>, I was thinking if we should consider an omnibus update to the following 47 templates so affected.

The 47 templates:

includes/calendar.inc
includes/columns_settings.inc
includes/datatables.inc
includes/doc-head-close.inc
includes/greybox.inc
includes/opac-bottom.inc
includes/password_check.inc
includes/slip-print.inc
modules/clubs/clubs-tab.tt
modules/clubs/enroll.tt
modules/opac-account.tt
modules/opac-advsearch.tt
modules/opac-auth-detail.tt
modules/opac-auth-MARCdetail.tt
modules/opac-auth.tt
modules/opac-basket.tt
modules/opac-course-details.tt
modules/opac-course-reserves.tt
modules/opac-detail.tt
modules/opac-downloadshelf.tt
modules/opac-full-serial-issues.tt
modules/opac-idref.tt
modules/opac-illrequests.tt
modules/opac-imageviewer.tt
modules/opac-MARCdetail.tt
modules/opac-memberentry.tt
modules/opac-messaging.tt
modules/opac-overdrive-search.tt
modules/opac-passwd.tt
modules/opac-password-recovery.tt
modules/opac-readingrecord.tt
modules/opac-request-article.tt
modules/opac-reserve.tt
modules/opac-results-grouped.tt
modules/opac-results.tt
modules/opac-review.tt
modules/opac-search-history.tt
modules/opac-shareshelf.tt
modules/opac-shelves.tt
modules/opac-showreviews.tt
modules/opac-suggestions.tt
modules/opac-tags.tt
modules/opac-topissues.tt
modules/opac-user.tt
modules/sco/help.tt
modules/sco/printslip.tt
modules/sco/sco-main.tt


Reference:

[1] https://www.w3.org/TR/2017/REC-html52-20171214/obsolete.html#warnings-for-obsolete-but-conforming-features
Comment 1 Indranil Das Gupta 2018-01-21 17:44:56 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2018-01-22 13:30:11 UTC Comment hidden (obsolete)
Comment 3 Indranil Das Gupta 2018-01-22 20:00:03 UTC
@Owen:

I've added the fix for the forbidden patterns detected by qa tools in a separate patch as you had suggested i.e. Bug 20066.
Comment 4 Julian Maurice 2018-01-29 16:13:34 UTC Comment hidden (obsolete)
Comment 5 Julian Maurice 2018-01-29 16:13:37 UTC Comment hidden (obsolete)
Comment 6 Jonathan Druart 2018-01-30 16:54:49 UTC
What about the staff interface?
Comment 7 Owen Leonard 2018-01-30 16:57:34 UTC
(In reply to Jonathan Druart from comment #6)
> What about the staff interface?

The staff client templates should be similarly modified, but with so many "move template javascript to the footer" patches in various stages of QA I think it should wait.
Comment 8 Jonathan Druart 2018-02-12 19:13:42 UTC
Hi Indranil, the patch does not longer apply, can you rebase?
It sounds like it would be better to regenerate it, I guess you wrote a small script?
Comment 9 Indranil Das Gupta 2018-02-12 20:18:50 UTC
I will get to it.
Comment 10 Owen Leonard 2018-05-01 13:28:54 UTC
Created attachment 74946 [details] [review]
Bug 20053: Drop type attribute "text/javascript" in OPAC templates

This patch is a reimplementation of the original from Indranil Das Gupta
and the QA follow-up from Julian Maurice. Original test plan:

Conformance rules for HTML5 is generating warnings for <script> element
with type="text/javascript" attribute when the OPAC page is checked
with W3C Validator. This patch removes the cause of these warnings.

Test plan
=========

1/ Paste the URL to your OPAC page (if it is hosted) to W3C Validator
   and watch about 10+ warnings being generated by the validator.

2/ Apply patch and re-submit the page to the Validator. The warnings
   would be gone.
Comment 11 Jon Knight 2018-06-04 16:32:13 UTC
Created attachment 75781 [details] [review]
Bug 20053: Drop type attribute "text/javascript" in OPAC templates

This patch is a reimplementation of the original from Indranil Das Gupta
and the QA follow-up from Julian Maurice. Original test plan:

Conformance rules for HTML5 is generating warnings for <script> element
with type="text/javascript" attribute when the OPAC page is checked
with W3C Validator. This patch removes the cause of these warnings.

Test plan
=========

1/ Paste the URL to your OPAC page (if it is hosted) to W3C Validator
   and watch about 10+ warnings being generated by the validator.

2/ Apply patch and re-submit the page to the Validator. The warnings
   would be gone.

Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Comment 12 Jonathan Druart 2018-06-04 17:47:41 UTC
Created attachment 75783 [details] [review]
Bug 20053: Drop type attribute "text/javascript" in OPAC templates

This patch is a reimplementation of the original from Indranil Das Gupta
and the QA follow-up from Julian Maurice. Original test plan:

Conformance rules for HTML5 is generating warnings for <script> element
with type="text/javascript" attribute when the OPAC page is checked
with W3C Validator. This patch removes the cause of these warnings.

Test plan
=========

1/ Paste the URL to your OPAC page (if it is hosted) to W3C Validator
   and watch about 10+ warnings being generated by the validator.

2/ Apply patch and re-submit the page to the Validator. The warnings
   would be gone.

Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 13 Nick Clemens 2018-06-08 13:56:36 UTC
Pushed to master for 18.11, awesome work all!
Comment 14 Martin Renvoize 2018-06-11 09:05:08 UTC
This patch has been pushed to 18.05.x and will be in 18.05.01
Comment 15 Fridolin SOMERS 2018-06-14 13:22:06 UTC
Too much conflicts in 17.11.x.
Since its not critical, I choose not to backport