A vocabulary and associated APIs for HTML and XHTML
The Selectors specification leaves the case-sensitivity of IDs, classes, element names, attribute names, and attribute values to be defined by the host language. [SELECTORS]
The unique identifier of HTML elements in documents that are in quirks mode must be treated as ASCII case-insensitive for the purposes of selector matching.
Classes from the class attribute of HTML elements
  in documents that are in quirks mode must be treated as ASCII
  case-insensitive for the purposes of selector matching.
Attribute and element names of HTML elements in HTML documents must be treated as ASCII case-insensitive for the purposes of selector matching.
Everything else (attribute values on HTML elements, IDs and classes in no-quirks mode and limited-quirks mode, and element names, attribute names, and attribute values in XML documents) must be treated as case-sensitive for the purposes of selector matching.
There are a number of dynamic selectors that can be used with HTML. This section defines when these selectors match HTML elements. [SELECTORS] [CSSUI]
:link:visitedAll a elements that have an href
    attribute, all area elements that have an href attribute, and all link elements that have
    an href attribute, must match one of :link and :visited.
Other specifications might apply more specific rules regarding how these elements are to match these pseudo-classes, to mitigate some privacy concerns that apply with straightforward implementations of this requirement.
:activeThe :active pseudo-class is defined to match an element
    while an
    element is being activated by the user
. For the purposes of defining the :active pseudo-class only, an HTML user agent must consider an
    element as being activated if it is:
An element falling into one of the following categories between the time the user begins to indicate an intent to trigger the element's activation behavior and either the time the user stops indicating an intent to trigger the element's activation behavior, or the time the element's activation behavior has finished running, which ever comes first:
a elements that have an href
       attributearea elements that have an href
       attributelink elements that have an href
       attributebutton elements that are not disabledinput elements whose type attribute is
       in the Submit Button, Image Button, Reset
       Button, or Button stateFor example, if the user is using a keyboard to push a button
      element by pressing the space bar, the element would match this pseudo-class in between the
      time that the element received the keydown event and the
      time the element received the keyup event.
An element that the user indicates using a pointing device while that pointing device is in the "down" state (e.g. for a mouse, between the time the mouse button is pressed and the time it is depressed).
An element that has a descendant that is currently matching the :active pseudo-class.
:hoverThe :hover pseudo-class is
    defined to match an element while
    the user designates an element with a pointing device
.
    For the purposes of defining the :hover pseudo-class only, an HTML
    user agent must consider an element as being one that the user
    designates if it is:
An element that the user indicates using a pointing device.
An element that has a descendant that the user indicates using a pointing device.
An element that is the labeled control of a
      label element that is currently matching :hover.
Consider in particular a fragment such as:
<p> <label for=c> <input id=a> </label> <span id=b> <input id=c> </span> </p>
If the user designates the element with ID "a" with their pointing device, then the
     p element (and all its ancestors not shown in the
     snippet above), the label element, the element with
     ID "a", and the element with ID "c" will match the :hover pseudo-class. The element
     with ID "a" matches it from condition 1,
     the label and p elements match it
     because of condition 2 (one of their descendants is designated),
     and the element with ID "c" matches it
     through condition 3 (its label element matches :hover). However, the element with
     ID "b" does not match :hover: its descendant is not
     designated, even though it matches :hover.
:enabledThe :enabled pseudo-class
    must match any element falling into one of the following
    categories:
a elements that have an href attributearea elements that have an href attributelink elements that have an href attributebutton elements that are not disabledinput elements that are not disabledselect elements that are not disabledtextarea elements that are not disabledoptgroup elements that do not have a disabled attributeoption elements that are not disabledfieldset elements that do not have a disabled attribute:disabledThe :disabled pseudo-class must match any element that
    is actually disabled.
:checkedThe :checked pseudo-class
    must match any element falling into one of the following
    categories:
input elements whose type attribute is in the Checkbox state and whose
     checkedness state is
     trueinput elements whose type attribute is in the Radio Button state and whose
     checkedness state is
     trueoption elements whose selectedness is
     true:indeterminateThe :indeterminate
    pseudo-class must match any element falling into one of the
    following categories:
input elements whose type attribute is in the Checkbox state and whose
     indeterminate IDL
     attribute is set to trueinput elements whose type attribute is in
     the Radio Button state and whose radio button
     group contains no input elements whose checkedness state is true.progress elements with no value content attribute:defaultThe :default pseudo-class
    must match any element falling into one of the following
    categories:
button elements that are their form's
     default buttoninput elements whose type attribute is in the Submit Button or Image Button state, and that
     are their form's default buttoninput elements to which the checked attribute applies and
     that have a checked
     attributeoption elements that have a selected attribute:validThe :valid pseudo-class
    must match any element falling into one of the following
    categories:
form elements that are not the form
     owner of any elements that themselves are candidates for
     constraint validation but do not satisfy their constraints:invalidThe :invalid pseudo-class
    must match any element falling into one of the following
    categories:
form elements that are the form
     owner of one or more elements that themselves are candidates for
     constraint validation but do not satisfy their constraintsfieldset elements that have of one or more descendant elements that themselves
     are candidates for constraint validation but do not satisfy their constraints:in-rangeThe :in-range
    pseudo-class must match all elements that are candidates for
    constraint validation, have range limitations,
    and that are neither suffering from an underflow nor
    suffering from an overflow.
:out-of-rangeThe :out-of-range
    pseudo-class must match all elements that are candidates for
    constraint validation, have range limitations,
    and that are either suffering from an underflow or
    suffering from an overflow.
:requiredThe :required
    pseudo-class must match any element falling into one of the
    following categories:
:optionalThe :optional
    pseudo-class must match any element falling into one of the
    following categories:
:read-only:read-writeThe :read-write pseudo-class must match any element
    falling into one of the following categories, which for the purposes of Selectors are thus
    considered user-alterable: [SELECTORS]
input elements to which the readonly attribute applies,
     and that are mutable (i.e. that
     do not have the readonly
     attribute specified and that are not disabled)textarea elements that do not have a readonly attribute, and
     that are not disabledinput elements nor textarea
     elementsThe :read-only
    pseudo-class must match all other HTML elements.
:dir(ltr)The :dir(ltr) pseudo-class must
    match all elements whose directionality is 'ltr'.
:dir(rtl)The :dir(rtl) pseudo-class must
    match all elements whose directionality is 'rtl'.
Another section of this specification defines the
  target element used with the :target pseudo-class.
This specification does not define when an element
  matches the :focus or :lang() dynamic pseudo-classes, as
  those are all defined in sufficient detail in a language-agnostic
  fashion in the Selectors specification. [SELECTORS]