Skip to content

Commit

Permalink
Merge pull request #303 from recurly/fix-reinstantiation-integrity-check
Browse files Browse the repository at this point in the history
Ensures configuration objects are not externally mutable
  • Loading branch information
jayseeg authored Nov 1, 2016
2 parents a0d9564 + 40f9451 commit 69fbce2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/recurly/hosted-field.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Emitter from 'component-emitter';
import events from 'component-event';
import MutationObserver from 'mutation-observer';
import clone from 'component-clone';
import dom from '../util/dom';
import errors from '../errors';

Expand Down Expand Up @@ -58,6 +58,7 @@ export class HostedField extends Emitter {
// Private

configure (options) {
options = clone(options);
this.target = dom.element(global.document.querySelector(options.selector));
if (!this.target) {
const {type, selector} = options;
Expand Down
7 changes: 4 additions & 3 deletions lib/recurly/hosted-fields.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import omit from 'lodash.omit';
import merge from 'lodash.merge';
import clone from 'component-clone';
import Emitter from 'component-emitter';
import merge from 'lodash.merge';
import omit from 'lodash.omit';
import {HostedField} from './hosted-field';
import errors from '../errors';

Expand Down Expand Up @@ -53,7 +54,7 @@ export class HostedFields extends Emitter {
// Private

configure (options) {
this.config = options || {};
this.config = clone(options || {});
}

inject () {
Expand Down

0 comments on commit 69fbce2

Please sign in to comment.