Re: Stand-in color before images load

Having a general purpose pseudo class to represent the loading status 
of elements that reference externally sourced data sounds like a useful 
idea.

Perhaps it would be useful to have something like ":loading", 
":loaded", and ":loadfail"?  It seems like this could be used to 
appropriately style images while they are loading, after they have 
loaded, or if they fail to load.

While on this topic, would it also be useful to have something like 
":rendered" and ":renderfail" to allow one to, for example, style a 
fallback <img> (such as a PNG) for an <object> (such as an SVG 
document) which refers to a document type for which no renderer exists?

Would these pseudo classes be expensive for useragents to implement?  
It seems like they should be tracking this sort of status anyway.  
There are probably issues that would have to be addressed to prevent 
the creation of loops, since unlike the anchor pseudo classes, these 
would allow the properties set by them to affect the status of the 
pseudo class (rather than being triggered only by user input).  Is that 
inherently a bad idea?

josh.


On Mar 29, 2005, at 4:22 PM, Matthew Raymond wrote:

>
> Laurens Holst wrote:
>> Matthew Raymond wrote:
>>>  Perhaps what we need is "alt" styling...
>>>
>>> | p { background: transparent url("marble.png"); }
>>> | p:alt { background-color: black; }
>> I don’t know if that would work...
>> p { background: transparent url("marble1.png");
>>      content: url("marble2.png"); }
>> p:alt { background-color: black; }
>> When will the :alt be visible, marble1.png fails to load, or 
>> marble2.png, or both?
>
>    I guess both. Just ":alt" would be a general file load failure. 
> Really, what we need is to be able to feed a property name to :alt to 
> pick a specific property that triggers the alternative styling.
>
> | p {
> |   background: transparent url("marble1.png");
> |   content: url("marble2.png");
> | }
> |
> | p:alt(background-image) { background-color: black; }
> | p:alt(content) { content: "Image failed to display: marble2.png"; }
> | p:alt(background-image):alt(content) { color: white; }
>
>
>> Also, this is just about images not loading, right?
>
>    I suppose it could be generalized to files not loading...
>
> > There are a limited amount of /properties/ with which you can
>> load images. Is it logical to ‘fix’ something done by properties with 
>> a selector?
>
>    It is if you want something more sophisticated than a canned, 
> single property solution.
>
>> Wouldn’t it be easier to introduce an equally limited amount of 
>> properties for this specific functionality?
>
>   Not necessarily. Depends on the user agent architecture and the 
> nature of the new properties. If you have to test to see if the 
> properties apply, though, I would assume you could roll that test into 
> a CSS selector.
>
> > Also, I think this would
>> then be the first selector which becomes valid based on the state of 
>> CSS itself. What if you load an image inside an :alt selector?
>
>    Forbid image loading for properties of :alt. There's no reason to 
> have them anyways, since the idea is that the images can't be loaded.
>
>    Then again, you could have situations where a specific image format 
> won't load. I think that perhaps a different solution would be better 
> for that, though. Perhaps something like this:
>
> | p { background: transparent url("marble.png", "marble.gif"); }
>
>> Replace the p with img and you’ve got an even more complex case.
>
>    :alt(self)???
>

Received on Wednesday, 30 March 2005 05:35:00 UTC