No desga, trust me here and just test my code ;-)
The link is only for testing, not for instructions.
The point is that (unlike that page) we do not want to FORCE the placeholder boxes on the users, they must still have free choice whether they want that standards-alt-text-thing OR boxes. And the blue code above only kicks in if a user has switched the default mode to boxes.
My only point here is, if a user HAS chosen the boxes as his standard, he shall be able to also see the zero-images, those that actually have always gotten a box too - just unfortunately 0x0 px, so a bit too tiny to see
For testing it's possible (while NOT resizing those images), to just put a border around them, and the border will show around a 0x0 dot...
Oh and by the way, that is how things work in "quirks mode pages" by default, the right half of the test images there! Only on "standards mode pages" someone has forgotten the zero-image fix.
About the height, I'm omitting that just to shorten the code for browser speed reasons, assuming that an image that has a width also has a height ;-)
And the width is only 22px, because the broken-image.gif is not quadratic either. Way back when I used to surf with IE5, it had on all sides the same margins around the broken image icon, and I've always been slightly irritated that in gecko the right margin is different from the other 3 sides.
Just for clarification, those missing-image settings are a science in itself, and I struggled a hundred hours in the past year with trying to cure that stupid broken image stuff. Also took a while to figure out that the "placeholder" checkbox doesn't toggle the "placeholder" pref! That's probably some confusion from developers, regardless what they explain in the jar-code.
Actually the about:config-pref for "placeholders" (=box) is toggled by the setting for "ICONS for missing images", and this only decides whether or not there will show the broken-image.gif inside the placeholder BOX, not if the box itself will be there or not.
And all what the pref-tab's checkbox for "block-like placeholders" actually does, is to add or remove this line to the
usercontents.css:
img { -moz-force-broken-image-icon: 1 !important; }
Meanwhile I know that this setting is valid for *all* images on a page, not only the broken ones, so no need to restrict it to them. It only has an effect anyway if an image is broken. It does NOT say "Force a broken-icon for this image, no matter the size". It says: "IF this image breaks, then show a little empty image frame, the "placeholder", in the size that is given in the img tag". Bad luck if the (not) given size is zero, except on quirks-mode-pages.
Anyway, only if this setting/line is added by the user (because he checked in the prefs "BLOCK-like PLACEHOLDERS in standards mode"), the size-check from my blue code will have any effect at all.
Edited 6 time(s). Last edit at 08/26/2010 04:52AM by siria.