- From: Bert Bos <bert@w3.org>
- Date: Thu, 21 Feb 2008 20:04:23 +0100
- To: www-style <www-style@w3.org>
On Thursday 21 February 2008 16:14, Daniel Glazman wrote: > Bert Bos wrote: > > A pseudo-class represents a state. According to CSS, elements can > > be active, visited, link, first-child, disabled, target, invalid, > > etc. I'm adding one more: initial. > > > > How do you currently query CSS states from Javascript? Can't you > > generalize (one of) the existing methods to include ':initial' as > > well? > > > > And there is actually nothing special about the LI. In my example > > the LI *doesn't* have an ':initial' state. There may be any number > > of elements whose states influence the style of the LI, because of > > cascading or inheritance. > > Riiiiigggghht. But this does not solve my problem here. You can't > query the :visited state from non-chrome JS for instance. Any > CSS-based solution for foldable tree-like rendering of elements w/o a > JS way to query the state is useless. I wouldn't quite say it's useless... :-) But if there is such a need to query the state of an element, what stops us from inventing a function and putting it in the CSSOM? Here is the first draft: isInitial: element → boolean ∪ ⊥ It gives one of three answers: true, false or nil. In an OOP language, the first argument would probably be written on the left side of the function name: "element.isInitial()". Bert -- Bert Bos ( W 3 C ) http://www.w3.org/ http://www.w3.org/people/bos W3C/ERCIM bert@w3.org 2004 Rt des Lucioles / BP 93 +33 (0)4 92 38 76 92 06902 Sophia Antipolis Cedex, France
Received on Thursday, 21 February 2008 19:09:22 UTC