n null;
            do {
                if (typeof el.matches === "function" && el.matches(s)) return el;
                el = el.parentElement || el.parentNode;
            } while (el !== null);
            return null;
        };
    }

    function getCurrentChapterFileName(givenUrl) {
        var currentChapterFileName = givenUrl.substr(givenUrl.lastIndexOf("/") + 1);
        if (currentChapterFileName === "index.html" || currentChapterFileName === "") {
            currentChapterFileName = givenUrl.s