+ all -

Excuse me, are you lost? Perhaps you would care to visit the site map

timshel.

Composition

There are 3 comments on this article.

Would you like to add another?

"Everything counts a little more than we think..."

26 May 2005 Thursday

Adjacent selectors should work both ways

slated in site-building at 10:16 am

absurd that CSS thought to have adjacent selectors but didn’t have any provisions for targetting an element BEFORE another, not just after.

ie.
E + F { color: blue; } will make the F immediately following an E be blue. ... so how the heck do you make an E immediately preceeding an F be blue?? ugh. so necessary. so unavailable.

“they’re” working on it, but ugh!

last-of-type should get here sooner than later, and precedents should have been targetable when descendents were.

p.s. i didn’t contribute anything to building it (CSS), so i don’t have tons of ground to complain on.. but… it just seems like it would have been such a sensible idea.. and i don’t know/understand what the deal is with CSS3 availability.. when? which browsers? how?

Comments on Adjacent selectors should work both ways

  1. When? Good question. I’d guess next year sometime at the soonest.

    Which browsers? Well, Mozilla, Opera and Safari already support some CSS3 selectors. IE still doesn’t support a fair number of CSS2 selectors (including adjacent siblings), so I wouldn’t get my hopes up.

    How? Kicking and screaming, as always.

    Your live preview is misbehaving, btw.
    commented Thu 26 May 2005, 2:05:15 PM :: link
  2. Also, if you ever absolutely need a “reverse” adjacent sibling selector, the DOM2 method nextSibling will let you fake it with JavaScript.
    commented Thu 26 May 2005, 2:07:39 PM :: link
  3. good to know about nextSibling, thank you…
    still a bit unsettled that they could think up the whole adjacent thing without considering the precedent thing.. maybe they had good reasons… maybe..
    commented Fri 27 May 2005, 2:22:35 AM :: link
Subscribe to XML comments feed for this article

If you don't have one (and would like one), get a Gravatar.

Add your comment here:

*Must click Preview first, and your comment will NOT go through until
you hit SUBMIT after previewing. (It's a spam-prevention thing.)
From here you may like to visit the archive, go home,
or page through other journal entries: