1Form Autofill Heuristics
2========================
3
4Form Autofill Heuristics module is for detecting the field type based on `autocomplete attribute <https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill>`_, `the regular expressions <http://searchfox.org/mozilla-central/source/browser/extensions/formautofill/content/heuristicsRegexp.js>`_ and the customized logic in each parser.
5
6Debugging
7---------
8
9The pref ``extensions.formautofill.heuristics.enabled`` is "true" in default. Set it to "false" could be useful to verify the result of autocomplete attribute.
10
11Dependent APIs
12--------------
13
14``element.getAutocompleteInfo()`` provides the parsed result of ``autocomplete`` attribute which includes the field name and section information defined in `autofill spec <https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill>`_
15
16Regular Expressions
17-------------------
18
19This section is about how the regular expression is applied during parsing fields. All regular expressions are in `heuristicsRegexp.js <https://searchfox.org/mozilla-central/source/browser/extensions/formautofill/content/heuristicsRegexp.js>`_.
20
21Parser Implementations
22----------------------
23
24The parsers are for detecting the field type more accurately based on the near context of a field. Each parser uses ``FieldScanner`` to traverse the interested fields with the result from the regular expressions and adjust each field type when it matches to a grammar.
25
26* _parsePhoneFields
27
28  * related type: ``tel``, ``tel-*``
29
30* _parseAddressFields
31
32  * related type: ``address-line[1-3]``
33
34* _parseCreditCardExpirationDateFields
35
36  * related type: ``cc-exp``, ``cc-exp-month``, ``cc-exp-year``
37
38