Skip to content

Commit

Permalink
fix: check filtered form elements
Browse files Browse the repository at this point in the history
  • Loading branch information
dbajpeyi committed Jul 16, 2024
1 parent 6c543b6 commit deb7fb7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
7 changes: 4 additions & 3 deletions dist/autofill-debug.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions dist/autofill.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/Form/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,11 @@ class Form {
// For form elements we use .elements to catch fields outside the form itself using the form attribute.
// It also catches all elements when the markup is broken.
// We use .filter to avoid fieldset, button, textarea etc.
// Additionally, we try to find any shadow elements that might be there in the form.
const formElements = [...this.form.elements]
// If there are not form elements, we try to look for all
// enclosed elements within the form.
const formElements = [...this.form.elements].filter((el) => el.matches(selector))
foundInputs = formElements.length > 0
? formElements.filter((el) => el.matches(selector))
? formElements
: findEnclosedElements(this.form, selector)
} else {
foundInputs = this.form.querySelectorAll(selector)
Expand Down
7 changes: 4 additions & 3 deletions swift-package/Resources/assets/autofill-debug.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions swift-package/Resources/assets/autofill.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit deb7fb7

Please sign in to comment.