-
Notifications
You must be signed in to change notification settings - Fork 122
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
Conversation
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
Conflicts: README.md
Conflicts: CHANGELOG.md
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