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

Allow access to instance of JS class on the HTML element #283

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

nfourtythree
Copy link
Contributor

Description

Currently the JS is setting the instance of the PaymentIntentsElements class into a data property on the element. This results in a value of [Object Object] meaning it is unusable to a developer.

This PR updates the code to simply add the instance directly to a property on the DOM node (using expando).

Meaning you are now able to access the instance and do something like the following:

document.querySelector('.stripe-payment-elements-form').handlerInstance.elements.update({
  appearance: {theme: 'night'}
});

Related issues

#275

@nfourtythree nfourtythree self-assigned this Jan 5, 2024
@nfourtythree nfourtythree requested a review from a team as a code owner January 5, 2024 07:37
@nfourtythree nfourtythree linked an issue Jan 5, 2024 that may be closed by this pull request
@nfourtythree nfourtythree merged commit 941d054 into develop Jan 5, 2024
5 checks passed
@nfourtythree nfourtythree deleted the bugfix/275-access-to-stripe-instance-js branch January 5, 2024 08:37
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.

[4.0.1.1] Cannot access handlerInstance
1 participant