palcarazm/bootstrap5-toggle

[BUG] 'Empty string passed to getElementById().' warning on Firefox.

DarkNami opened this issue ยท 7 comments

Describe the bug
If the <input> has not set ID attribute, it will cause 'Empty string passed to getElementById().' warning on Firefox.

To Reproduce
Steps to reproduce the behavior and minimal code:

  1. Launch Firefox
  2. Open URL https://palcarazm.github.io/bootstrap5-toggle/
  3. Press F12 open developer panel.
  4. Click 'Console' panel.
  5. Hover cursor to any bootstrap toggle.
  6. You will see many 'Empty string passed to getElementById().' warnings.

Expected behavior
Don't add for attribute if attribute ID does not exist.

Screenshots
Issue

Desktop:

  • OS: Windows 10
  • Browser: Firefox
  • Version: 108

Additional context
I had fix this issue for old bootstrap4-toggle on my fork.
DarkNami@76fb0c1

Do you need I create a PR for this issue or palcarazm can fix it ? (it is short, only 4 lines changes.)

Hi! ๐Ÿ‘‹
Thanks for your issue. You are helping to improve Bootstrap 5 toggle.

Hi @DarkNami ,

Thanks for the issue ๐Ÿ˜Š.

If you can do a PR so you will be listed as controntibutor.
If you cann't I will read and import your code an add the source in comments.

Hi @palcarazm ,

I am not familiar with GitHub. ๐Ÿ˜ต

I have tried to fork your repositorie palcarazm / bootstrap5-toggle, but GitHub say 'No more forks can be created. These forks already exist.'. I don't know how to sync my bootstrap4-toggle fork to your bootstrap5-toggle. ๐Ÿค”

Okay, don't worry. I will merge your changes and put you as co-author of the commit.

Thank you. ๐Ÿ‘

Done! It will be released in the next patch.

I have tested it, warning is stopped.
Thank you.