W3C home > Mailing lists > Public > www-style@w3.org > December 2011

Re: [css4-ui]/[css4-selectors] Pseudo-class for selecting broken images & other external resources

From: L. David Baron <dbaron@dbaron.org>
Date: Wed, 28 Dec 2011 10:03:58 -0500
To: Lea Verou <leaverou@gmail.com>
Cc: www-style list <www-style@w3.org>
Message-ID: <20111228150358.GA20752@pickering.dbaron.org>
On Wednesday 2011-12-28 13:01 +0200, Lea Verou wrote:
> It was to my surprise that not only I couldn't find any current
> pseudo-class for this, but also I couldn't even find a relevant
> discussion on the list.
> 
> Being able to select broken images has many popular use cases:
> - Showing a more user-friendly and/or relevant message to the user,
> something more fitting to the rest of the site perhaps
> - Forcing UAs to display the alt text even when they don't by
> default, as simply as img[alt]:error { content: attr(alt); }
> - Controlling the dimensions of the broken image placeholder
> - Hiding broken images
> - Using the selectors API to select all broken images and display a
> message somewhere

Mozilla actually already has pseudo-classes to match different types
of images that cannot be displayed:
  https://developer.mozilla.org/en/CSS/:-moz-broken
  https://developer.mozilla.org/en/CSS/:-moz-loading
  https://developer.mozilla.org/en/CSS/:-moz-user-disabled
  https://developer.mozilla.org/en/CSS/:-moz-suppressed
These are needed to describe our internal behavior in our UA style
sheet.

> Mozilla even goes as far as to have a custom property for
> rudimentary control over the display of broken images:
> https://developer.mozilla.org/en/CSS/-moz-force-broken-image-icon

-moz-force-broken-image-icon is an ancient hack used to implement a
quirks mode behavior.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂
Received on Wednesday, 28 December 2011 15:04:28 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:47 GMT