mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-23 22:33:42 -04:00
Compatibility update for Internet Explorer
This commit is contained in:
@@ -53,9 +53,11 @@ export default class Listener {
|
||||
* Register listener for all relevant events
|
||||
*/
|
||||
listen() {
|
||||
for (const el of this.els_)
|
||||
for (const event of this.events_)
|
||||
Array.prototype.forEach.call(this.els_, el => {
|
||||
this.events_.forEach(event => {
|
||||
el.addEventListener(event, this.update_, false)
|
||||
})
|
||||
})
|
||||
|
||||
/* Execute setup handler, if implemented */
|
||||
if (typeof this.handler_.setup === "function")
|
||||
@@ -66,9 +68,11 @@ export default class Listener {
|
||||
* Unregister listener for all relevant events
|
||||
*/
|
||||
unlisten() {
|
||||
for (const el of this.els_)
|
||||
for (const event of this.events_)
|
||||
Array.prototype.forEach.call(this.els_, el => {
|
||||
this.events_.forEach(event => {
|
||||
el.removeEventListener(event, this.update_)
|
||||
})
|
||||
})
|
||||
|
||||
/* Execute reset handler, if implemented */
|
||||
if (typeof this.handler_.reset === "function")
|
||||
|
||||
@@ -100,8 +100,9 @@ export default class Blur {
|
||||
* Reset anchor states
|
||||
*/
|
||||
reset() {
|
||||
for (const el of this.els_)
|
||||
Array.prototype.forEach.call(this.els_, el => {
|
||||
el.dataset.mdState = ""
|
||||
})
|
||||
|
||||
/* Reset index and page y-offset */
|
||||
this.index_ = 0
|
||||
|
||||
@@ -48,23 +48,23 @@ export default class Scrolling {
|
||||
|
||||
/* Find all toggles and check which one is active */
|
||||
const toggles = this.el_.querySelectorAll("[data-md-toggle]")
|
||||
for (const toggle of toggles) {
|
||||
if (!toggle.checked)
|
||||
return
|
||||
Array.prototype.forEach.call(toggles, toggle => {
|
||||
if (toggle.checked) {
|
||||
|
||||
/* Find corresponding navigational pane */
|
||||
let pane = toggle.nextElementSibling
|
||||
while (pane.tagName !== "NAV")
|
||||
pane = pane.nextElementSibling
|
||||
/* Find corresponding navigational pane */
|
||||
let pane = toggle.nextElementSibling
|
||||
while (pane.tagName !== "NAV")
|
||||
pane = pane.nextElementSibling
|
||||
|
||||
/* Find current and parent list elements */
|
||||
const parent = toggle.parentNode.parentNode
|
||||
const target = pane.children[pane.children.length - 1]
|
||||
/* Find current and parent list elements */
|
||||
const parent = toggle.parentNode.parentNode
|
||||
const target = pane.children[pane.children.length - 1]
|
||||
|
||||
/* Always reset all lists when transitioning */
|
||||
parent.style.webkitOverflowScrolling = ""
|
||||
target.style.webkitOverflowScrolling = "touch"
|
||||
}
|
||||
/* Always reset all lists when transitioning */
|
||||
parent.style.webkitOverflowScrolling = ""
|
||||
target.style.webkitOverflowScrolling = "touch"
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,22 +116,22 @@ export default class Scrolling {
|
||||
|
||||
/* Find all toggles and check which one is active */
|
||||
const toggles = this.el_.querySelectorAll("[data-md-toggle]")
|
||||
for (const toggle of toggles) {
|
||||
if (!toggle.checked)
|
||||
return
|
||||
Array.prototype.forEach.call(toggles, toggle => {
|
||||
if (toggle.checked) {
|
||||
|
||||
/* Find corresponding navigational pane */
|
||||
let pane = toggle.nextElementSibling
|
||||
while (pane.tagName !== "NAV")
|
||||
pane = pane.nextElementSibling
|
||||
/* Find corresponding navigational pane */
|
||||
let pane = toggle.nextElementSibling
|
||||
while (pane.tagName !== "NAV")
|
||||
pane = pane.nextElementSibling
|
||||
|
||||
/* Find current and parent list elements */
|
||||
const parent = toggle.parentNode.parentNode
|
||||
const target = pane.children[pane.children.length - 1]
|
||||
/* Find current and parent list elements */
|
||||
const parent = toggle.parentNode.parentNode
|
||||
const target = pane.children[pane.children.length - 1]
|
||||
|
||||
/* Always reset all lists when transitioning */
|
||||
parent.style.webkitOverflowScrolling = ""
|
||||
target.style.webkitOverflowScrolling = ""
|
||||
}
|
||||
/* Always reset all lists when transitioning */
|
||||
parent.style.webkitOverflowScrolling = ""
|
||||
target.style.webkitOverflowScrolling = ""
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ export default class Result {
|
||||
|
||||
/* Perform search on index and render documents */
|
||||
const result = this.index_.search(ev.target.value)
|
||||
for (const item of result) {
|
||||
result.forEach(item => {
|
||||
const doc = this.data_[item.ref]
|
||||
this.list_.appendChild(
|
||||
<li class="md-search-result__item">
|
||||
@@ -128,7 +128,7 @@ export default class Result {
|
||||
</a>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
/* Update search metadata */
|
||||
this.meta_.textContent =
|
||||
|
||||
Reference in New Issue
Block a user