mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-22 12:01:15 -04:00
Correct usage of classList method (#738)
This commit is contained in:
parent
5270bcf155
commit
5a2ea27df1
@ -1323,7 +1323,8 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'settingsStore','abstractFilesys
|
|||||||
|
|
||||||
// Extract any css classes from the html tag (they will be stripped when injected in iframe with .innerHTML)
|
// Extract any css classes from the html tag (they will be stripped when injected in iframe with .innerHTML)
|
||||||
var htmlCSS = htmlArticle.match(/<html[^>]*class\s*=\s*["']\s*([^"']+)/i);
|
var htmlCSS = htmlArticle.match(/<html[^>]*class\s*=\s*["']\s*([^"']+)/i);
|
||||||
htmlCSS = htmlCSS ? htmlCSS[1] : '';
|
// Normalize classList and convert to array
|
||||||
|
htmlCSS = htmlCSS ? htmlCSS[1].replace(/\s+/g, ' ').split(' ') : [];
|
||||||
|
|
||||||
// Tell jQuery we're removing the iframe document: clears jQuery cache and prevents memory leaks [kiwix-js #361]
|
// Tell jQuery we're removing the iframe document: clears jQuery cache and prevents memory leaks [kiwix-js #361]
|
||||||
$('#articleContent').contents().remove();
|
$('#articleContent').contents().remove();
|
||||||
@ -1357,7 +1358,9 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'settingsStore','abstractFilesys
|
|||||||
docBody = docBody ? docBody[0] : null;
|
docBody = docBody ? docBody[0] : null;
|
||||||
if (docBody) {
|
if (docBody) {
|
||||||
// Add any missing classes stripped from the <html> tag
|
// Add any missing classes stripped from the <html> tag
|
||||||
if (htmlCSS) docBody.classList.add(htmlCSS);
|
if (htmlCSS) htmlCSS.forEach(function (cl) {
|
||||||
|
docBody.classList.add(cl);
|
||||||
|
});
|
||||||
// Deflect drag-and-drop of ZIM file on the iframe to Config
|
// Deflect drag-and-drop of ZIM file on the iframe to Config
|
||||||
docBody.addEventListener('dragover', handleIframeDragover);
|
docBody.addEventListener('dragover', handleIframeDragover);
|
||||||
docBody.addEventListener('drop', handleIframeDrop);
|
docBody.addEventListener('drop', handleIframeDrop);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user