1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-28 01:10:58 +01:00

Compatibility update for Internet Explorer

This commit is contained in:
squidfunk 2016-12-28 18:54:26 +01:00
parent 3f5957bd01
commit db73d4863a
12 changed files with 113 additions and 103 deletions

View File

@ -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 */

View File

@ -39,6 +39,7 @@ export default (gulp, config, args) => {
.pipe(
stream({
entry: [
"core-js/fn/promise",
"whatwg-fetch",
"application.js"
],

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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 = {

View File

@ -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

View File

@ -36,11 +36,12 @@
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-react-jsx": "^6.8.0",
"babel-polyfill": "^6.16.0",
"babel-polyfill": "^6.20.0",
"babel-preset-es2015": "^6.13.2",
"babel-register": "^6.16.3",
"babel-root-import": "^4.1.3",
"chai": "^3.5.0",
"core-js": "^2.4.1",
"css-mqpacker": "^4.0.0",
"del": "^2.2.0",
"eslint": "^3.6.1",

View File

@ -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)
})
})
}
}

View File

@ -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")

View File

@ -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

View File

@ -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 = ""
}
})
}
}

View File

@ -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 =