Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7e9fc1d

Browse filesBrowse files
authored
Merge pull request plotly#1254 from plotly/add-frames-accept-null
Add frames accept only frames that pass Lib.isPlainObject
2 parents 5bce249 + 27c274e commit 7e9fc1d
Copy full SHA for 7e9fc1d

File tree

Expand file treeCollapse file tree

2 files changed

+9
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-0
lines changed

‎src/plot_api/plot_api.js

Copy file name to clipboardExpand all lines: src/plot_api/plot_api.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,6 +2566,8 @@ Plotly.addFrames = function(gd, frameList, indices) {
25662566

25672567
var insertions = [];
25682568
for(i = frameList.length - 1; i >= 0; i--) {
2569+
if(!Lib.isPlainObject(frameList[i])) continue;
2570+
25692571
var name = (_hash[frameList[i].name] || {}).name;
25702572
var newName = frameList[i].name;
25712573

‎test/jasmine/tests/frame_api_test.js

Copy file name to clipboardExpand all lines: test/jasmine/tests/frame_api_test.js
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ describe('Test frame api', function() {
4343
}).catch(fail).then(done);
4444
});
4545

46+
it('compresses garbage when adding frames', function(done) {
47+
Plotly.addFrames(gd, [null, 'garbage', 14, true, false, {name: 'test'}, null]).then(function() {
48+
expect(Object.keys(h)).toEqual(['test']);
49+
expect(f).toEqual([{name: 'test'}]);
50+
}).catch(fail).then(done);
51+
});
52+
4653
it('treats a null list as a noop', function(done) {
4754
Plotly.addFrames(gd, null).then(function() {
4855
expect(Object.keys(h)).toEqual([]);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.