-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scanner: discard Form instances with no classified inputs (#574)
When encountering <form/>s with no fillable inputs, the Scanner and Form classes previously maintained MutationObservers for each <form/>. This allowed the global MutationObserver to detect newly-added <input/>s and attribute them to existing Form instances without having to create a new Form, but also meant we maintained observers and listeners that often went unused. For performance reasons, we stop processing <form/> elements once 30 Form instances have been created. This allowed a large number of unfillable <form/>s could consume the entire Form pool before an actually-fillable <form/> is encountered. Immediately `destroy()` a Form instance that contains no fillable <input/>s, and avoid adding that instance to a Scanner's set of known Form instances. This ensures form-scoped listeners and observers are only maintained when a fillable field is present. When a new <input/> is added the global MutationObserver and Scanner create a new Form instance to manage it, enabling slightly lazier listener/observer initialization.
- Loading branch information
Showing
18 changed files
with
175 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.