Skip to content

Commit

Permalink
fix: check if form elements are iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
dbajpeyi committed Aug 7, 2024
1 parent a3bab7d commit 48ea818
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion dist/autofill-debug.js

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

3 changes: 2 additions & 1 deletion dist/autofill.js

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

4 changes: 2 additions & 2 deletions src/Form/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ class Form {
} else {
/** @type {Element[] | NodeList} */
let foundInputs = []

if (this.form instanceof HTMLFormElement) {
// Some sites seem to be overriding `form.elements`, so we need to check if it's still iterable, otherwise we break the site.
if (this.form instanceof HTMLFormElement && Symbol.iterator in Object(this.form.elements)) {
// 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.
Expand Down
3 changes: 2 additions & 1 deletion swift-package/Resources/assets/autofill-debug.js

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

3 changes: 2 additions & 1 deletion 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 48ea818

Please sign in to comment.