calipho-sib / sequence-viewer

neXtProt protein sequence viewer (javascript) - From SIB CALIPHO group; neXtProt project
https://cdn.rawgit.com/calipho-sib/sequence-viewer/master/examples/index.html
50 stars 17 forks source link

Using classes instead of IDs #3

Closed terrymun closed 8 years ago

terrymun commented 8 years ago

Just my two cents: would it make more sense to use classes instead of IDs? This would be very helpful in certain use cases where there are multiple instances of Sequence Viewers initialised on a single page. In this scenario, all instances will contain HTML elements of an identical ID, #sequenceHeader, #sequenceBody, #scroller …just to name a few, and that is semantically invalid.

Usually this does not throw any error of sorts, but when attempting to manipulate specific instances with JS results in undefined behaviour, since the documentQuerySelector (or jQuery's $() selector) will be unable to target a specific instance due to duplicate IDs.

MatSchaeff commented 8 years ago

Hi Terry,

You're absolutely right, I changed the IDs to Classes. http://rawgit.com/calipho-sib/sequence-viewer/master/examples/index.html (You might need to clear the cache and refresh the page)

Thank you for your contribution ! :)

Cheers,

Mathieu

terrymun commented 8 years ago

Thanks for the quick fix! :+1: