Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container input support #159

Closed
buu700 opened this issue May 11, 2017 · 3 comments
Closed

Container input support #159

buu700 opened this issue May 11, 2017 · 3 comments

Comments

@buu700
Copy link

buu700 commented May 11, 2017

I was skimming some of the source code in lieu of documentation (see #158), when I noticed this: https://github.com/braintree/braintree-web-drop-in/blob/182bd39/src/dropin.js#L47

  if (!this._merchantConfiguration.selector) {
    analytics.sendEvent(this._client, 'configuration-error');
    callback(new DropinError('options.selector is required.'));
    return;
  }

  container = document.querySelector(this._merchantConfiguration.selector);

In Braintree v2, directly passing in container with a DOM element was supported (and my existing code depends on this). Would you be willing to add that option back in this module?

@crookedneighbor
Copy link
Contributor

We decided not to support it in order to simplify the API.

Can you explain why your integration depends on it? Does the element not have an id property you can leverage? IE:

braintree.dropin.create({
  authorization: auth,
  selector: '#' + myDomNode.id
}, callback);

@buu700
Copy link
Author

buu700 commented May 11, 2017

We're using Braintree in an Angular component, so the most obvious way to access the intended DOM node is as a descendant of the root of the component.

Although, now that I think about it, while it's a bit of a hack, we can just generate a random GUID and set it as the ID to use for the selector.

@crookedneighbor
Copy link
Contributor

This was released in version 1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants