Skip to content

Commit 9e9d756

Browse files
authored
Merge pull request #1557 from hy9be/perf-addLinks
Remove the performance overhead of showLink property
2 parents b4318ad + 603656c commit 9e9d756

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/plots/plots.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ plots.previousPromises = function(gd) {
257257
* Add source links to your graph inside the 'showSources' config argument.
258258
*/
259259
plots.addLinks = function(gd) {
260+
// Do not do anything if showLink and showSources are not set to true in config
261+
if(!gd._context.showLink && !gd._context.showSources) return;
262+
260263
var fullLayout = gd._fullLayout;
261264

262265
var linkContainer = fullLayout._paper

test/jasmine/tests/config_test.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,7 @@ describe('config argument', function() {
160160

161161
var link = document.getElementsByClassName('js-plot-link-container')[0];
162162

163-
expect(link.textContent).toBe('');
164-
165-
var bBox = link.getBoundingClientRect();
166-
expect(bBox.width).toBe(0);
167-
expect(bBox.height).toBe(0);
163+
expect(link).toBeUndefined();
168164
});
169165

170166
it('should display a link when true', function() {

0 commit comments

Comments
 (0)