Validate a DOM element, like a text input, against a set of rules.