microoptimization: 'style' is already a deep-copy

This commit is contained in:
tophf 2018-01-04 22:47:29 +03:00
parent c553c0270e
commit 45219a88c1

View File

@ -210,11 +210,16 @@ function createStyleElement({style, name, index}) {
parts.oldUpdate.classList.toggle('hidden', !style.updateUrl); parts.oldUpdate.classList.toggle('hidden', !style.updateUrl);
} }
// clear the code to free up some memory
// (note, style is already a deep copy)
style.sourceCode = null;
style.sections.forEach(section => (section.code = null));
const entry = parts.entry.cloneNode(true); const entry = parts.entry.cloneNode(true);
entry.id = ENTRY_ID_PREFIX_RAW + style.id; entry.id = ENTRY_ID_PREFIX_RAW + style.id;
entry.styleId = style.id; entry.styleId = style.id;
entry.styleNameLowerCase = name || style.name.toLocaleLowerCase(); entry.styleNameLowerCase = name || style.name.toLocaleLowerCase();
entry.styleMeta = getStyleWithNoCode(style); entry.styleMeta = style;
entry.className = parts.entryClassBase + ' ' + entry.className = parts.entryClassBase + ' ' +
(style.enabled ? 'enabled' : 'disabled') + (style.enabled ? 'enabled' : 'disabled') +
(style.updateUrl ? ' updatable' : '') + (style.updateUrl ? ' updatable' : '') +