fix $ for detached nodes
This commit is contained in:
parent
98da86f816
commit
f041f2265a
|
@ -13,7 +13,7 @@ async function StyleSettings() {
|
||||||
await t.fetchTemplate('/edit/settings.html', SS_ID);
|
await t.fetchTemplate('/edit/settings.html', SS_ID);
|
||||||
const {style} = editor;
|
const {style} = editor;
|
||||||
const ui = t.template[SS_ID].cloneNode(true);
|
const ui = t.template[SS_ID].cloneNode(true);
|
||||||
const elAuto = $('[id="config.autosave"]', ui);
|
const elAuto = $('#config\\.autosave', ui);
|
||||||
const elSave = $('#ss-save', ui);
|
const elSave = $('#ss-save', ui);
|
||||||
const pendingSetters = new Map();
|
const pendingSetters = new Map();
|
||||||
const updaters = [
|
const updaters = [
|
||||||
|
|
|
@ -67,7 +67,7 @@ setTimeout(() => !cm && showSpinner($('#header')), 200);
|
||||||
|
|
||||||
({tabId, initialUrl} = preinit);
|
({tabId, initialUrl} = preinit);
|
||||||
liveReload = initLiveReload();
|
liveReload = initLiveReload();
|
||||||
preinit.tpl.then(el => $('#ss-scheme').append(...$('[id=ss-scheme]', el).children));
|
preinit.tpl.then(el => $('#ss-scheme').append(...$('#ss-scheme', el).children));
|
||||||
|
|
||||||
const [
|
const [
|
||||||
{dup, style, error, sourceCode},
|
{dup, style, error, sourceCode},
|
||||||
|
|
|
@ -64,11 +64,11 @@ window.messageBoxProxy = new Proxy({}, {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function $(selector, base = document) {
|
function $(selector, base) {
|
||||||
// we have ids with . like #manage.onlyEnabled which looks like #id.class
|
// we have ids with . like #manage.onlyEnabled which looks like #id.class
|
||||||
// so since getElementById is superfast we'll try it anyway
|
// so since getElementById is superfast we'll try it anyway
|
||||||
const byId = selector.startsWith('#') && document.getElementById(selector.slice(1));
|
const byId = !base && selector.startsWith('#') && document.getElementById(selector.slice(1));
|
||||||
return byId || base.querySelector(selector);
|
return byId || (base || document).querySelector(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
function $$(selector, base = document) {
|
function $$(selector, base = document) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user