explicitly use 'window' when getting its properties

This commit is contained in:
tophf 2017-04-03 07:24:50 +03:00
parent 1af1194e9f
commit 59899b9395
2 changed files with 7 additions and 7 deletions

10
edit.js
View File

@ -1113,8 +1113,8 @@ function init() {
section[CssToProperty[i]] = [params[i]]; section[CssToProperty[i]] = [params[i]];
} }
} }
onload = () => { window.onload = () => {
onload = null; window.onload = null;
addSection(null, section); addSection(null, section);
// default to enabled // default to enabled
document.getElementById("enabled").checked = true document.getElementById("enabled").checked = true
@ -1132,12 +1132,12 @@ function init() {
} }
styleId = style.id; styleId = style.id;
setStyleMeta(style); setStyleMeta(style);
onload = () => { window.onload = () => {
onload = null; window.onload = null;
initWithStyle({style}); initWithStyle({style});
}; };
if (document.readyState != 'loading') { if (document.readyState != 'loading') {
onload(); window.onload();
} }
}); });
} }

View File

@ -70,7 +70,7 @@ function showStyles(styles = []) {
const sorted = styles const sorted = styles
.map(style => ({name: style.name.toLocaleLowerCase(), style})) .map(style => ({name: style.name.toLocaleLowerCase(), style}))
.sort((a, b) => (a.name < b.name ? -1 : a.name == b.name ? 0 : 1)); .sort((a, b) => (a.name < b.name ? -1 : a.name == b.name ? 0 : 1));
const shouldRenderAll = history.state && history.state.scrollY > innerHeight; const shouldRenderAll = (history.state || {}).scrollY > window.innerHeight;
const renderBin = document.createDocumentFragment(); const renderBin = document.createDocumentFragment();
tDocLoader.stop(); tDocLoader.stop();
renderStyles(0); renderStyles(0);
@ -477,7 +477,7 @@ function searchStyles({immediately, container}) {
function rememberScrollPosition() { function rememberScrollPosition() {
history.replaceState({scrollY}, document.title); history.replaceState({scrollY: window.scrollY}, document.title);
} }