dokuwiki-plugin-bootswrapper icon indicating copy to clipboard operation
dokuwiki-plugin-bootswrapper copied to clipboard

Random CSS id selector sometimes starts with a number - which is forbidden

Open manuelebarraco opened this issue 1 year ago • 1 comments

Hi! I'm using the accordion from your plugin and it is perfect! I think I found a bug: in L244 of script.js the accordion_id is created using the random function from Math, getting a string which represents a number in base 36: accordion_id = Math.random().toString(36).substr(2, 9). This string sometimes starts with a number and this is forbidden in the HTML specification: when this happens the accordion doesn't work. I tried to solve this bug modifying that line in this way accordion_id = 'e_' + Math.random().toString(36).substr(2, 9) and it works!

Thanks for your work, Manuele

manuelebarraco avatar Aug 31 '23 18:08 manuelebarraco

Hi! I'm using the accordion from your plugin and it is perfect! I think I found a bug: in L244 of script.js the accordion_id is created using the random function from Math, getting a string which represents a number in base 36: accordion_id = Math.random().toString(36).substr(2, 9). This string sometimes starts with a number and this is forbidden in the HTML specification: when this happens the accordion doesn't work. I tried to solve this bug modifying that line in this way accordion_id = 'e_' + Math.random().toString(36).substr(2, 9) and it works!

Thanks for your work, Manuele

I applied your suggested fix to my fork https://github.com/Miro-Collas/dokuwiki-plugin-bootswrapper which resulted it being added to my PR #145

Miro-Collas avatar Apr 25 '24 05:04 Miro-Collas