utils.js (less.js-4.1.2) | : | utils.js (less.js-4.1.3) | ||
---|---|---|---|---|
skipping to change at line 12 | skipping to change at line 12 | |||
export function extractId(href) { | export function extractId(href) { | |||
return href.replace(/^[a-z-]+:\/+?[^\/]+/, '') // Remove protocol & domain | return href.replace(/^[a-z-]+:\/+?[^\/]+/, '') // Remove protocol & domain | |||
.replace(/[\?\&]livereload=\w+/, '') // Remove LiveReload cachebu ster | .replace(/[\?\&]livereload=\w+/, '') // Remove LiveReload cachebu ster | |||
.replace(/^\//, '') // Remove root / | .replace(/^\//, '') // Remove root / | |||
.replace(/\.[a-zA-Z]+$/, '') // Remove simple extension | .replace(/\.[a-zA-Z]+$/, '') // Remove simple extension | |||
.replace(/[^\.\w-]+/g, '-') // Replace illegal character s | .replace(/[^\.\w-]+/g, '-') // Replace illegal character s | |||
.replace(/\./g, ':'); // Replace dots with colons( for valid id) | .replace(/\./g, ':'); // Replace dots with colons( for valid id) | |||
} | } | |||
export function addDataAttr(options, tag) { | export function addDataAttr(options, tag) { | |||
if (!tag) {return;} // in case of tag is null or undefined | ||||
for (const opt in tag.dataset) { | for (const opt in tag.dataset) { | |||
if (tag.dataset.hasOwnProperty(opt)) { | if (tag.dataset.hasOwnProperty(opt)) { | |||
if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') { | if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') { | |||
options[opt] = tag.dataset[opt]; | options[opt] = tag.dataset[opt]; | |||
} else { | } else { | |||
try { | try { | |||
options[opt] = JSON.parse(tag.dataset[opt]); | options[opt] = JSON.parse(tag.dataset[opt]); | |||
} | } | |||
catch (_) {} | catch (_) {} | |||
} | } | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added |