-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: Serialize select elements values #295
Conversation
Still fighting TS though
I'd rather make something `any` than cast everything to a type that's incorrect but makes TS happy.
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.
👍 Approving as all code makes sense when reading through. Trust you've exercised appropriately to consider it reliable.
const formElements = Array.from(formNodes) as HTMLFormElement[] | ||
|
||
formElements.forEach((elem) => { | ||
const inputId = elem.getAttribute('data-percy-element-id') | ||
const selector = `[data-percy-element-id="${inputId}"]` | ||
const cloneEl = clonedDOM.querySelector(selector) as HTMLInputElement | ||
const cloneEl = clonedDOM.querySelector(selector) as any |
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 called it out in the commit that made this change, but want to be clear here too.
I made this any since we're looping over an array of DOM nodes that can be any of these (at this time): select
, input
, textarea
Since TS doesn't allow you to recast a type, I'd rather make this any
since the type of node can/will change with each loop.
# [0.9.0](v0.8.3...v0.9.0) (2019-07-22) ### Features * Serialize select elements values ([#295](#295)) ([3df435b](3df435b))
What is this?
This will capture the selected values from
<select>
elements.TODOs:
scoped
import fromdom.test.ts
file