Bug 27336: Sanitize correctly HTML id
authorJulian Maurice <julian.maurice@biblibre.com>
Fri, 8 Jan 2021 09:58:45 +0000 (10:58 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 11 Jan 2021 13:04:19 +0000 (14:04 +0100)
commit7660b558b4d8f5de75f53779943af84606b97d71
tree3ce6864b83399b7993bfe80afd6e23932978e62a
parent06ab9baea06a58d168e9807c441930c0af0e9276
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>
(cherry picked from commit d89f6027be001d537b0eb73ea3fb4641d5fcd292)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
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]