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]];
}
}
onload = () => {
onload = null;
window.onload = () => {
window.onload = null;
addSection(null, section);
// default to enabled
document.getElementById("enabled").checked = true
@ -1132,12 +1132,12 @@ function init() {
}
styleId = style.id;
setStyleMeta(style);
onload = () => {
onload = null;
window.onload = () => {
window.onload = null;
initWithStyle({style});
};
if (document.readyState != 'loading') {
onload();
window.onload();
}
});
}

View File

@ -70,7 +70,7 @@ function showStyles(styles = []) {
const sorted = styles
.map(style => ({name: style.name.toLocaleLowerCase(), style}))
.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();
tDocLoader.stop();
renderStyles(0);
@ -477,7 +477,7 @@ function searchStyles({immediately, container}) {
function rememberScrollPosition() {
history.replaceState({scrollY}, document.title);
history.replaceState({scrollY: window.scrollY}, document.title);
}