Skip to content

Commit

Permalink
fixes leaking options between recognizer instances by coping the opti…
Browse files Browse the repository at this point in the history
…ons object into a new object upon instantiation

hammerjs#813
  • Loading branch information
Christian Meixner committed Jun 25, 2015
1 parent 8ab166d commit 286363a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hammer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1256,10 +1256,13 @@ var STATE_FAILED = 32;
* @param {Object} options
*/
function Recognizer(options) {
// make sure, options are copied over to a new object to prevent leaking it outside
options = extend({}, options || {});

this.id = uniqueId();

this.manager = null;
this.options = merge(options || {}, this.defaults);
this.options = merge(options, this.defaults);

// default is enable true
this.options.enable = ifUndefined(this.options.enable, true);
Expand Down

0 comments on commit 286363a

Please sign in to comment.