Add Object.assign polyfill for IE11

This commit is contained in:
Josh Dzielak
2019-02-27 01:02:48 +01:00
parent c0b6afd06b
commit 45bc91896d
+30
View File
@@ -25,6 +25,36 @@
<!-- always use local version of the notes plugin since HTML file it requires isn't on CDN --> <!-- always use local version of the notes plugin since HTML file it requires isn't on CDN -->
<script type="text/javascript" src="{{ "reveal-js/plugin/notes/notes.js" | relURL }}"></script> <script type="text/javascript" src="{{ "reveal-js/plugin/notes/notes.js" | relURL }}"></script>
<script type="text/javascript"> <script type="text/javascript">
// polyfill needed for IE11 and below
if (typeof Object.assign != 'function') {
// Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", {
value: function assign(target, varArgs) { // .length of function is 2
'use strict';
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
},
writable: true,
configurable: true
});
}
// Hugo lowercases all params and Reveal.js needs camelcase // Hugo lowercases all params and Reveal.js needs camelcase
// So params in Hugo must be stored in snakecase and we camelize them here // So params in Hugo must be stored in snakecase and we camelize them here
function camelize(map) { function camelize(map) {