calx.js
calx.js copied to clipboard
Multiple sheets inoperable due to data-calx-identifier attribute collision
The method for creating a data-calx-identifer
hash leads to collisions which can make pages with multiple sheets inoperable:
init : function (option) {
//code omitted
sheetIdentifier = 'CALX'+(new Date()).valueOf();
Using date to create the hash value can lead to identical hash ids if sheets are initialised quickly:
$('.multiple_sheet_selector').calx({data:});
console.log( $('[data-calx-identifier="CALX1515156401661"]').length );
//outputs 2
This means there is only effectively one sheet in the page - which will be the last one init'd.