[whatwg] borders on images inside links

Henri Sivonen hsivonen at iki.fi
Tue Mar 2 03:51:20 PST 2010

On Mar 2, 2010, at 12:41, Markus Ernst wrote:

> I apologize for the case this is a stupid suggestion: Could the spec say that the default for HTML5 is no border, but UAs are encouraged to render linked images in documents with pre-HTML5 or no doctypes with a border?

Taking your suggestion literally would mean introducing a fourth layout mode in addition to quirks, limited quirks (aka. almost standards) and standards. The modes are enough implementation trouble as they are, so I wouldn't support adding a new one.

What about making the standards mode borderless by default but making the quirks mode have the border by default? This would be historically consistent. The purpose of the quirks mode is to cater for late 1990s authoring practices and the reason to have the default border is to avoid changing the appearance of pages from the 1990s. (In the past decade, authors haven't been able to rely on the default border either way, because the default browser on Mac for at least the past decade--first Mac IE 5 and then Safari--hasn't had the default border.)

Still, I wouldn't support a mode-based divergence here. I think it's safe to assume that the same people who have control over the doctype also have control over page-wide style rules. The already is a page-wide precise toggle for the border behavior: img { border: 0; }. I think that, in retrospect, especially considering the difference between the almost standards mode and the standards mode, making style/layout characteristics depend on the doctype is a worse solution that having a targeted CSS-based toggle (see http://hsivonen.iki.fi/almost-precedent/).

More to the point, having a toggle of any kind for this behavior wouldn't solve the problem that I'm interested in solving by not having a default border. My primary concern isn't that authors who control the entire page have to include an additional incantation (img { border: 0; }). My concern is that the default border makes copy-pasteable HTML fragments unnecessarily crufty, because the providers of these fragments feel compelled to zap the border regardless of the toggles in the target document.

Currently, the <style>img { border: 0; }</style> toggle is available, but providers of fragments still include border="0" or style="border: 0;". If there were also a doctype toggle, fragment providers would still probably resort to crufty markup.

(Yes, I realize that to get rid of the cruft, both Firefox *and IE* would need to change and old version of both of them would need to fade.)

Henri Sivonen
hsivonen at iki.fi

More information about the whatwg mailing list