Skip to content

Commit

Permalink
Merge branch 'nicky1038-jquery3-compatibility'
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkfranz committed Oct 22, 2019
2 parents a4a5179 + 38a1977 commit 1a3e76d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ A Cytoscape.js extension that wraps the [qTip jQuery library](http://qtip2.com)

## Dependencies

* jQuery ^2.0 || ^1.10.0, as qTip requires it
* jQuery ^3.0 || ^2.0 || ^1.10.0, as qTip requires it
* qTip ^3.0 || ^2.2.0
* Cytoscape.js ^2.2.0 || ^3.0.0

Expand Down
8 changes: 6 additions & 2 deletions cytoscape-qtip.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ SOFTWARE.
}
};

var fixDomContainer = function(ele) {
return ele && ( ele[0] === window ) ? undefined : ele;
};

var throttle = function(func, wait, options) {
var leading = true,
trailing = true;
Expand Down Expand Up @@ -196,8 +200,8 @@ SOFTWARE.

// qtip should be positioned relative to cy dom container
opts.position = opts.position || {};
opts.position.container = opts.position.container || $( document.body );
opts.position.viewport = opts.position.viewport || $( document.body );
opts.position.container = fixDomContainer(opts.position.container) || $( document.body );
opts.position.viewport = fixDomContainer(opts.position.viewport) || $( document.body );
opts.position.target = [0, 0];
opts.position.my = opts.position.my || 'top center';
opts.position.at = opts.position.at || 'bottom center';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"run-sequence": "^1.0.0"
},
"dependencies": {
"jquery": "^2.0 || ^1.10.0",
"jquery": "^3.0.0 || ^2.0 || ^1.10.0",
"qtip2": "^3.0 || ^2.2.0"
},
"peerDependencies": {
Expand Down

0 comments on commit 1a3e76d

Please sign in to comment.