Re: New version of the Selectors module of CSS3

On Sat, 7 Oct 2000, Bjoern Hoehrmann wrote:

> * "Ian Hickson" <ianh@netscape.com> wrote:
> | > | 1. :default pseudo-class.
> | > | represents the element that will be activated when the user presses
> | > | default
> | > | activate key (normally enter).
> | >
> | > "The :focus pseudo-class applies while an element has the focus (accepts
> | > keyboard or mouse events, or other forms of input)."
> | >
> | > Why do you think this does not apply to a submit button that accepts the
> | > keyboard event "return is pressed"?
> |
> | If the focus is on a text field, but hitting enter activates the submit
> | button (typical behaviour in most UIs and certainly most popular
> | browsers), then the button is not focussed prior to the enter key being
> | hit (and typically not after either).
> 
> The button accepts keyboard events, so it has the focus. Thats what the spec
> says. There is no need for a new pseudo-class.

But the input field accepts keyboard events too. Are you seriously saying
that you think two elements at once have focus???

 
> | > | 2. pseudo-class inversion.
> | > (I think i do not really understand you mean)
> |
> | How would you style target anchors?
> 
> something like
> 
> a {
>   color: black
> }
> 
> and
> 
> a:link {
>   color: red
> }
> 
> or
> 
> a[href] {
>   color: red
> }

Right -- but that means you have to explicitly style the links too. That's
the whole problem. What if you don't know what their style should be?
(e.g. in a user stylesheet, or when the stylesheet is built from many
different ones.)


> If you get pseudo-class inversion i want to have attribute inversion like 'not
> equal', 'does not end with', 'has no attribute' and so on like
> 
> a[!href]
> a[href^!"http://www.w3.org"]
> ...

I have also proposed this (using the first syntax you gave!).

Here is the text of my proposal.

NEGATIVE ATTRIBUTE SELECTORS

Proposal: Every attribute selector should have a counterpart that
matches only if the attribute selector would *not* have matched.

Proposed syntax: Add a "!" after the "[".

Examples:

   [!title] /* absence */
   matches every element that does not have an "title" attribute.

   select[!size="1"]
   matches every "select" element that either does not have an
   attribute "size", or does not have one that is set to "1".

   :link[href][!href$="http://"]
   matches every unvisited link that has an "href" attribute and whose
   href attribute doesn't start with "http://". Without the [href]
   then this would also match unvisited links that do not have an
   "href" attribute at all.

   [!class~="important"]
   matches all elements which do not have the class "important".

   [!lang|="en"]
   matches any elements that do not have the "lang" attribute set, and
   any elements that _do_ have the "lang" attribute set but where it
   does not start with "en-" and is not "en".


> Maybe at this point we should have a more generic mechanism for inversion,
> maybe others want to style all classes not named "normative" and so on.

You can do this using my :matches proposal, which I have posted and
alluded to many times in the past.

-- 
Ian Hickson                                     )\     _. - ._.)       fL
Netscape, Standards Compliance QA              /. `- '  (  `--'
+1 650 937 6593                                `- , ) -  > ) \
irc.mozilla.org:Hixie _________________________  (.' \) (.' -' __________

Received on Friday, 6 October 2000 22:04:56 UTC