Skip to content
Snippets Groups Projects
Commit db73d486 authored by squidfunk's avatar squidfunk
Browse files

Compatibility update for Internet Explorer

parent 3f5957bd
No related branches found
No related tags found
No related merge requests found
......@@ -39,12 +39,13 @@ export default /* JSX */ {
/* Set all properties */
if (properties)
for (const attr of Object.keys(properties))
Array.prototype.forEach.call(Object.keys(properties), attr => {
el.setAttribute(attr, properties[attr])
})
/* Iterate child nodes */
const iterateChildNodes = nodes => {
for (const node of nodes) {
Array.prototype.forEach.call(nodes, node => {
/* Directly append text content */
if (typeof node === "string" ||
......@@ -59,7 +60,7 @@ export default /* JSX */ {
} else {
el.appendChild(node)
}
}
})
}
/* Iterate child nodes and return element */
......
......@@ -39,6 +39,7 @@ export default (gulp, config, args) => {
.pipe(
stream({
entry: [
"core-js/fn/promise",
"whatwg-fetch",
"application.js"
],
......
This diff is collapsed.
This diff is collapsed.
......@@ -110,7 +110,7 @@
<script src="https://cdn.mathjax.org/{{ path }}"></script>
{% endif %}
{% endfor %}
<script src="{{ base_url }}/assets/javascripts/application-5c0b7e9d97.js"></script>
<script src="{{ base_url }}/assets/javascripts/application-7f2d08a2e5.js"></script>
<script>
/* Configuration for application */
var config = {
......
......@@ -29,7 +29,7 @@ repo_name: squidfunk/mkdocs-material
repo_url: https://github.com/squidfunk/mkdocs-material
# Copyright
copyright: 'Copyright &copy 2016 Martin Donath'
copyright: 'Copyright &copy; 2016 Martin Donath'
# Documentation and theme
theme_dir: material
......
......@@ -62,7 +62,7 @@ export default class Application {
/* Wrap all data tables */
const tables = document.querySelectorAll("table:not([class])")
for (const table of tables) {
Array.prototype.forEach.call(tables, table => {
const wrap = document.createElement("div")
wrap.classList.add("md-typeset__table")
if (table.nextSibling) {
......@@ -71,7 +71,7 @@ export default class Application {
table.parentNode.appendChild(wrap)
}
wrap.appendChild(table)
}
})
}).listen()
/* Cross-browser helper to dispatch/fire an event */
......@@ -108,10 +108,11 @@ export default class Application {
/* Component: collapsible elements for navigation */
const collapsibles =
document.querySelectorAll("[data-md-component=collapsible]")
for (const collapse of collapsibles)
Array.prototype.forEach.call(collapsibles, collapse => {
new Material.Event.MatchMedia("(min-width: 1200px)",
new Material.Event.Listener(collapse.previousElementSibling, "click",
new Material.Nav.Collapse(collapse)))
})
/* Component: pane monitor for iOS scrolling fixes */
new Material.Event.MatchMedia("(max-width: 1199px)",
......@@ -218,9 +219,10 @@ export default class Application {
/* Render repository source information */
})().then(facts => {
const sources = document.querySelectorAll("[data-md-source]")
for (const source of sources)
Array.prototype.forEach.call(sources, source => {
new Material.Source.Repository(source)
.initialize(facts)
})
})
}
}
......@@ -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,9 +48,8 @@ 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
......@@ -65,6 +64,7 @@ export default class Scrolling {
parent.style.webkitOverflowScrolling = ""
target.style.webkitOverflowScrolling = "touch"
}
})
}
/**
......@@ -116,9 +116,8 @@ 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
......@@ -133,5 +132,6 @@ export default class Scrolling {
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 =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment