RE: CSS3 and Selectors

> -----Original Message-----
> From: www-style-request@w3.org 
> [mailto:www-style-request@w3.org] On Behalf Of Ian Hickson
> Sent: Monday, September 09, 2002 11:53 AM
> To: Adam van den Hoven
> Cc: 'W3C Style'
> Subject: RE: CSS3 and Selectors
> 
> 
> 
> On Mon, 9 Sep 2002, Adam van den Hoven wrote:
> > Ian wrote:
> > > On Fri, 6 Sep 2002, Adam van den Hoven wrote:
> > > > 
> > > > <a href="#"><span class="text">This is a link</span><img
> > > > src="/img/thisisalink.gif" alt="This is a link" /></a>
> > > 
> > > That is pointless. The whole point of the alt="" attribute is
> > > to include this alternate text. You don't need to explicitly 
> > > mention this in the stylesheet, either.
> > 
> > No its NOT pointless. This code would (and in fact does) 
> appear in an 
> > application that we host for a large number of clients. 
> Some of those 
> > clients have to resources to pay for customized graphics. Others 
> > don't, or don't care. Aside from accessibility issues, my 
> overriding 
> > concern is with these clients.
> 
> I don't understand why this requires you to write code like 
> that above.
> 
> If an image is missing, then it will be replaced by the alt 
> text. If the image is not missing

No, it creates a box of some size (when it has an idea what size the
missing image is, I never make those assumptions) and writes the alt
text in the space where the image would be and includes an X indicating
that the image is missing. Further, the text is not available for
selecting.

[Quickly check Mozilla...]

At least that's what IE does (as does NS4.7 for which this is part of
the graceful degradation). Whether or not they are interpreting the Recs
correctly, I'm not going to say. I can't ignore its behaviour (as much
as I want to) because it still dominates. 

Also, depending on the context, the semantically meaningful value will
be a piece of text not an image.  

Finally it may not be feasible to simply return nothing for the URL.
Even if nothing is returned, it will take time to make the request. Not
a lot, unless I have a whole lot of images on the page, which I may.

I also can't apply mark-up to the alt text which is important since when
ever the name of our product is written in plain text, it is necessary
to make the Direct in MemberDirect italicised.

But I'll admit that I may be holding on to the image/text issue a little
too tightly. 

> > > In CSS3 you will be able to directly change the content of an
> > > element, using the 'content' property, as in:
> > > 
> > >    @media screen {
> > >       a { content: url(/img/thisisalink); height: 2em; width:
20em; }
> > >    }
> > 
> > Well, that makes me very happy. Perhaps that is a much better
solution 
> > than being able to distinguish the text from the tag.
> > 
> > Mind you, I'm a big fan of using XPath-like selectors.
> 
> There was no XPath in there -- the url(...) syntax is from 
> CSS1, and means "this uri". So in this case, it is saying the 
> image is the file "/img/thisisalink". This is the same as in 
> your sample code, except without the pointless extension. 
> (Only Windows users need extensions. The Web uses 
> Content-Type headers instead, which allows for making URIs 
> independent of the format of the content.)

I know what XPaths are. I know how they work and I know how the url()
works too. I actually never use extensions, even for windows. I don't
think its necessary. I only put them in there to avoid confusion in this
post. 

My statement was out of context.

What I meant was that I think something LIKE XPath would make for a very
nice CSS selector. That is, I want to apply CSS properties to "All the
input tags that are children of a fieldset whose legend has an input
element whose type attribute is 'checkbox' and whose checkeded attribute
is 'checked'" or in other words:

fieldset[legend/input[@type='checkbox' and @checked='checked']]/input{
background-color:grey; color:dark-grey;}

It is unfortunate that here is currently no way to do this (as far as I
know). 

The reason I made the comment (which I should not have, it wasn't at all
useful) was that one could always refer to the text of an element with
XPath using a/text() so using XPaths for selectors would automatically
accomplish what I'm talking about. 

Thanks, 

Adam

Received on Monday, 9 September 2002 20:59:35 UTC