Skip to content

Commit

Permalink
Don't repeat isFormLikelyToBeUsedAsPageWrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Emanuele Feliziani <[email protected]>
  • Loading branch information
GioSensation committed Sep 15, 2023
1 parent d783890 commit 4b1222d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,15 @@ class DefaultScanner {
*/
getParentForm (input) {
if (input instanceof HTMLInputElement || input instanceof HTMLSelectElement) {
// Use input.form unless it encloses most of the DOM
// In that case we proceed to identify more precise wrappers
if (input.form && !isFormLikelyToBeUsedAsPageWrapper(input.form)) {
return input.form
if (input.form) {
// Use input.form unless it encloses most of the DOM
// In that case we proceed to identify more precise wrappers
if (
this.forms.has(input.form) || // If we've added the form we've already checked that it's not a page wrapper
!isFormLikelyToBeUsedAsPageWrapper(input.form)
) {
return input.form
}
}
}

Expand Down

0 comments on commit 4b1222d

Please sign in to comment.