tmort / Socialite

Other
1.68k stars 163 forks source link

Fixed VK Like widget initialisation for IE8 #49

Closed ghost closed 11 years ago

ghost commented 11 years ago

I run into a bug with VK Like widget in IE8. It may initialise Like widget twise If there are more than one Like button on the page because IE8 sometimes somehow can create several DOM elements at the exact same time, thus there are many elements on the page with the same ID. Random number seems to solve the problem.

dbushell commented 11 years ago

Thanks :)

It doesn't makes a real difference, but perhaps avoiding string manipulation may be a nanosecond faster! Instead of:

Math.random().toString().replace('.', '-');

Do this:

Math.floor(Math.random()*1000)

Who knows? Who cares!

ghost commented 11 years ago

Actually Math.floor(Math.random()*1000) looks much clearer :)