Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
manuelebarraco opened this issue Aug 31, 2023 · 1 comment

Comments

@manuelebarraco
Copy link

manuelebarraco commented Aug 31, 2023

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

Miro-Collas added a commit to Miro-Collas/dokuwiki-plugin-bootswrapper that referenced this issue Apr 25, 2024
Ref issue giterlizzi#146 (comment) 
Applied fix suggested by manuelebarraco
@Miro-Collas
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants