A list of supported CSS selectors when invoking g(..)

A list of supported CSS selectors when invoking g(..)

At it's most basic, Gimme is a utility for retrieving lots of elements quickly and then acting upon all of them at once. This is done through a call to the g(..) function.
The g(..) function takes one parameter: a string formatted like a CSS selector which indicates which elements you want Gimme to retrieve for you.

The following is a list of currently support CSS selectors (more to come);
*(univeral selector) matches any element
E matches ny E element (e.g. an element of type E)
E F matches any F element that is a descendant of an E element
E > F matches any F element that is a direct child of an E element
E + F matches any F element immediately preceded by an E element
E ~ F matches any F element that is a following sibling of an E element
E[foo] matches any E element that has the attribute foo (regardless of its value)
E[foo="warning"] matches any E element whose foo attribute is exactly "warning"
E[foo^="war"] matches any E element whose foo attribute starts with "war"
E[foo$="ing"] matches any E element whose foo attribute ends with "ing"
E[lang|="en"] matches any E element whose lang attribute has a hyphen-separated list of values beginning (from the left) with "en"
E.warning matches any E element that has the class "warning" applied to it
E.warning.severe matches any E element that has both classes "warning" and "severe" applied to it
#id matches any element whose id attribute is exactly id
E#id matches any E element whose id attribute is exactly id
E:first-child matches an E element, first child of its parent
E:last-child matches an E element, last child of its parent
E:nth-child(n) an E element, the n-th child of its parent

TODO:

  1. E[attr|val]
  2. E:enabled
  3. E:disabled
  4. E:checked
  5. E:target
  6. E:not
  7. E:root
  8. E:empty

你可能感兴趣的:(selector)