If you want to apply some jQuery code to an item, you use it’s selector. For example to turn on a class for all anchor tags (A) you use:
The “a” in bold is the “selector”. In this case we told jquery (which is “$”) to select all anchor tags. We then said, “with what is selected, toggle the className class on”.
Some newly introduced selectors are (where E is an element):
- E:not (s1, s2)
- E[foo=”bar” i]
- E:in-range, E:out-range
- E:required, E:optional
- E:nth-match(n of selector) – stated twice in the spec for some reason
- E /foo/ F – this sounds interesting, an F element referenced by E’s foo attribute
- $E > F – this will be important, it selects the “E” part of what used to only select F (you can still use E>F for the F element)
The current / past / future selectors are interesting. I’m not entirely sure what the indicators will be. The document is somewhat vague in whether you will define a “time/date” attribute, or if it’s just before / after in the document hierarchy. It sounds like there will be graceful degradation.
Of course, CSS4 won’t officially see the light of day likely for a few years. CSS3 isn’t technically finished yet either.
However, given a previous direction of no more “versions” of HTML. We can safely assume W3C will begin releasing these specs for browsers to incorporate at their earliest convenience.
It is a double edged sword. If a spec is implemented differently by different browsers, then we fork web developer code in the ambiguities of the early spec. Will browsers implement the past/current/future on their own?