diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php index 93c968f6..f2d691cc 100644 --- a/adminer/include/design.inc.php +++ b/adminer/include/design.inc.php @@ -82,7 +82,7 @@ fQIDAQAB echo script("mixin(document.body, {onkeydown: bodyKeydown, onclick: bodyClick" . (isset($_COOKIE["adminer_version"]) ? "" : ", onload: partial(verifyVersion, '$VERSION', '" . js_escape(ME) . "', '" . get_token() . "')") // $token may be empty in auth.inc.php . "}); -document.body.className = document.body.className.replace(/ nojs/, ' js'); +document.body.classList.replace('nojs', 'js'); const offlineMessage = '" . js_escape(lang('You are offline.')) . "'; const thousandsSeparator = '" . js_escape(lang(',')) . "';") ; diff --git a/adminer/static/editing.js b/adminer/static/editing.js index ea1f13dc..6a517166 100644 --- a/adminer/static/editing.js +++ b/adminer/static/editing.js @@ -696,7 +696,7 @@ function schemaMousemove(event) { const top = (event.clientY - y) / em; const lineSet = { }; for (const div of qsa('div', that)) { - if (div.className == 'references') { + if (div.classList.contains('references')) { const div2 = qs('[id="' + (/^refs/.test(div.id) ? 'refd' : 'refs') + div.id.substr(4) + '"]'); const ref = (tablePos[div.title] || [ div2.parentNode.offsetTop / em, 0 ]); let left1 = -1; diff --git a/adminer/static/functions.js b/adminer/static/functions.js index 048d2608..3754da97 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -69,7 +69,7 @@ function mixin(target, source) { */ function alterClass(el, className, enable) { if (el) { - el.className = el.className.replace(RegExp('(^|\\s)' + className + '(\\s|$)'), '$2') + (enable ? ' ' + className : ''); + el.classList[enable ? 'add' : 'remove'](className); } } @@ -79,7 +79,7 @@ function alterClass(el, className, enable) { */ function toggle(id) { const el = qs('#' + id); - alterClass(el, 'hidden', !/(^|\s)hidden(\s|$)/.test(el.className)); + el && el.classList.toggle('hidden'); return false; } diff --git a/editor/static/editing.js b/editor/static/editing.js index b03d8164..c7dcdcfd 100644 --- a/editor/static/editing.js +++ b/editor/static/editing.js @@ -32,7 +32,7 @@ function whisper(url) { const a = field.nextSibling.firstChild; if (a && a.firstChild.data == field.value) { field.previousSibling.value = decodeURIComponent(a.href.replace(/.*=/, '')); - a.className = 'active'; + a.classList.add('active'); } } }); diff --git a/plugins/codemirror.php b/plugins/codemirror.php index ed5fdb24..62c2472f 100644 --- a/plugins/codemirror.php +++ b/plugins/codemirror.php @@ -56,7 +56,7 @@ function getCmMode(el) { for (const el of qsa('code')) { const mode = getCmMode(el); if (mode) { - el.className += ' cm-s-default'; + el.classList.add('cm-s-default'); CodeMirror.runMode(el.textContent, mode, el); } }