A dirty class marks a form field after the user has interacted with it and moved away. JavaScript listens for the field’s blur event and adds dirty when the user clicks or tabs elsewhere. section 10.8
Combined with the :invalid pseudo-class, dirty prevents error messages from appearing before a user has had a chance to fill out the form. Untouched invalid fields remain quiet. section 10.8
Three field states
A name field can be invalid and dirty, valid, or invalid but not yet touched. The selector .dirty:invalid + .error span displays an adjacent error message only in the first state. section 10.8
