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

Add ability to pass in a DOM Node to Drop-in creation #165

Merged
merged 9 commits into from
May 22, 2017

Conversation

crookedneighbor
Copy link
Contributor

Summary

Some frameworks don't give you easy access to css selectors for the dom nodes where drop-in will be inserted. This allows people to pass in a container property instead of selector which will be the DOM Node to pass Drop-in into.

We could overload selector and allow it to take a DOM Node or a CSS selector, but I thought it would be a weird API for prop named selector to take a DOM Node directly.

Closes #159

Checklist

  • Added a changelog entry
  • Ran unit tests

Copy link
Contributor

@lilaconlee lilaconlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider changing container be like the container from v2 that accepts a dom node or a string and deprecate selector? I think that's long term less confusing but could go either way.

src/dropin.js Outdated
callback(new DropinError('options.selector is required.'));
callback(new DropinError('options.selector or options.container are required.'));
return;
} else if (selector && container) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this better than picking one by default? I could go either way.

Copy link
Contributor

@skunkworks skunkworks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think documenting the either/or behavior is a bit trickier than if we allow container to take both DOM nodes and selectors as Lila suggested, which makes me lean that way. I don't feel too strongly about it though.

@crookedneighbor crookedneighbor merged commit f9d1790 into master May 22, 2017
@crookedneighbor crookedneighbor deleted the allow_dom_node_to_be_passed branch May 24, 2017 17:28
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

Successfully merging this pull request may close these issues.

None yet

4 participants