Bug 27336: Sanitize correctly HTML id
authorJulian Maurice <julian.maurice@biblibre.com>
Fri, 8 Jan 2021 09:58:45 +0000 (10:58 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 11 Jan 2021 09:27:37 +0000 (10:27 +0100)
commitd89f6027be001d537b0eb73ea3fb4641d5fcd292
treea4a3e4f53564bf3f07f36f1223e48b9fc9890af3
parent9ab65aa6c36754db9c6b9e90efde6b05fec147a7
Bug 27336: Sanitize correctly HTML id

Valid characters are alphanumeric characters (a-zA-Z0-9), hyphen (-)
and underscore (_)

https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier

All invalid characters will be replaced by '_'

Test plan:
1. Go to Administration ยป System preferences and click on 'Searching'
   tab
2. You should see a console error (Uncaught Error: Syntax error,
   unrecognized expression: #collapse_Did_you_mean/spell_checking)
3. Apply patch
4. Make sure the error is gone
5. prove t/Koha_Template_Plugin_HtmlId.t

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Template/Plugin/HtmlId.pm [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
t/Koha_Template_Plugin_HtmlId.t [new file with mode: 0755]