LeaVerou / multirange

A tiny polyfill for HTML5 multi-handle sliders
http://projects.verou.me/multirange/
MIT License
605 stars 82 forks source link

avoid multiple initialization #2

Closed salvan13 closed 8 years ago

LeaVerou commented 8 years ago

Thanks, but it's easier to just check if it has the class multirange, instead of adding an extra attribute. Wanna try that? :)

LeaVerou commented 8 years ago

Thanks! However, I recently refactored the init code to account for usage in <head> (https://github.com/LeaVerou/multirange/commit/be92febef6d31d4551f060550077e4782d2e3154) and as part of that I added a :not(.multirange) to the selector which also prevents multiple intialization. Sorry! Thank you for contributing though!

salvan13 commented 8 years ago

It's OK, I like your solution :thumbsup:

salvan13 commented 8 years ago

But... what if someone calls multirange(input) twice?

LeaVerou commented 8 years ago

Ouch, good point. Yeah, it needs to check in multirange() as well. Can you simplify this PR to just check for classList.contains("multirange")? I'd rather keep this small.