Skip to content

Commit 3427479

Browse files
kurkleetimberg
authored andcommitted
IE11 compatibility (#6872)
1 parent dbd835f commit 3427479

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

src/core/core.animations.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ function copyOptions(target, values) {
4242
delete values.options;
4343
}
4444

45+
function extensibleConfig(animations) {
46+
const result = {};
47+
Object.keys(animations).forEach(key => {
48+
const value = animations[key];
49+
if (!isObject(value)) {
50+
result[key] = value;
51+
}
52+
});
53+
return result;
54+
}
55+
4556
export default class Animations {
4657
constructor(chart, animations) {
4758
this._chart = chart;
@@ -50,12 +61,17 @@ export default class Animations {
5061
}
5162

5263
configure(animations) {
64+
if (!isObject(animations)) {
65+
return;
66+
}
67+
5368
const animatedProps = this._properties;
54-
const animDefaults = Object.fromEntries(Object.entries(animations).filter(({1: value}) => !isObject(value)));
69+
const animDefaults = extensibleConfig(animations);
5570

56-
for (let [key, cfg] of Object.entries(animations)) {
71+
Object.keys(animations).forEach(key => {
72+
const cfg = animations[key];
5773
if (!isObject(cfg)) {
58-
continue;
74+
return;
5975
}
6076
for (let prop of cfg.properties || [key]) {
6177
// Can have only one config per animation.
@@ -66,7 +82,7 @@ export default class Animations {
6682
animatedProps.set(prop, extend({}, animatedProps.get(prop), cfg));
6783
}
6884
}
69-
}
85+
});
7086
}
7187

7288
/**

src/core/core.controller.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ function mergeScaleConfig(config, options) {
6868
});
6969

7070
// apply scale defaults, if not overridden by dataset defaults
71-
Object.values(scales).forEach(scale => {
71+
Object.keys(scales).forEach(key => {
72+
const scale = scales[key];
7273
helpers.mergeIf(scale, scaleService.getScaleDefaults(scale.type));
7374
});
7475

@@ -139,9 +140,9 @@ function updateConfig(chart) {
139140
chart.tooltip.initialize();
140141
}
141142

142-
const KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
143+
const KNOWN_POSITIONS = new Set(['top', 'bottom', 'left', 'right', 'chartArea']);
143144
function positionIsHorizontal(position, axis) {
144-
return position === 'top' || position === 'bottom' || (!KNOWN_POSITIONS.includes(position) && axis === 'x');
145+
return position === 'top' || position === 'bottom' || (!KNOWN_POSITIONS.has(position) && axis === 'x');
145146
}
146147

147148
function compare2Level(l1, l2) {

0 commit comments

Comments
 (0)