mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-09 12:19:46 -04:00
Prevent errors with selecting iframe contentDocument
Former-commit-id: 1d9cf8cca626f41cb698d1d793456501e93f32f3 [formerly 49f708867f1db6852e244dbbedea41d875e983fc [formerly 4942c86da696276b4349793537ad1e28537bb6c4]] Former-commit-id: fc350a68b5590bd9ead33ae98caf214e335da542 Former-commit-id: 7b1703f432632dac1aee2ea3a71acc37ea0dd15e
This commit is contained in:
parent
4a834f7e9f
commit
c4a9537f9b
@ -3669,7 +3669,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'cook
|
||||
// Sets state of collapsible sections
|
||||
function openAllSections(override, node) {
|
||||
var open = override === false ? false : override || params.openAllSections;
|
||||
var container = node || frames[0].frameElement.contentDocument;
|
||||
var container = node || document.getElementById('articleContent');
|
||||
var blocks = container.querySelectorAll('details, section:not([data-mw-section-id="0"]), .collapsible-block, .collapsible-heading');
|
||||
if (node) processSection(open, node);
|
||||
for (var x = blocks.length; x--;) {
|
||||
@ -3702,7 +3702,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'cook
|
||||
|
||||
// Attach listeners to headers to open-close following sections
|
||||
function setupHeadings() {
|
||||
var headings = frames[0].frameElement.contentDocument.querySelectorAll('h2, h3, h4, h5');
|
||||
var headings = document.getElementById('articleContent').querySelectorAll('h2, h3, h4, h5');
|
||||
for (var i = headings.length; i--;) {
|
||||
// Prevent heading from being selected when user clicks on it
|
||||
headings[i].style.userSelect = 'none';
|
||||
|
Loading…
x
Reference in New Issue
Block a user