[whatwg] contenteditable, <em> and <strong>

Henri Sivonen hsivonen at iki.fi
Tue Jan 9 09:19:43 PST 2007


On Jan 8, 2007, at 20:21, Simon Pieters wrote:

> I think it is no surprise that most UAs will implement this as  
> emitting <em> for CTRL+I and <stong> for CTRL+B, or similar  
> interfaces that imply that the user actually requested italics or  
> bold with (to the UA) unknown intended semantics. (IE and Opera  
> emit <em> and <strong>, Safari emits <SPAN class="Apple-style-span"  
> style="font-weight: bold;">.) I think <i> and <b> should be emitted  
> instead, and the above text should reflect that.

Two of the four implementations that the WHATWG cares about  
interoperate. Is it worthwhile to disrupt that situation—especially  
considering that changes to Trident are the hardest for the WHATWG to  
induce?

My conclusion is that semantic markup has failed in this case. <em>  
and <i> are both used primarily to achieve italic rendering on the  
visual media. <strong> and <b> are both primarily used to achieve  
bold rendering on the visual media. Regardless of which tags authors  
type or which tags their editor shortcuts produce, authors tend to  
think in terms of encoding italicizing and bolding instead of  
knowingly articulating their profound motivation for using italics or  
bold. Even those who have heard about the theoretical reasons for  
using <em> and <strong> tend to decide which one to use based on  
which one has the preferred default visual presentation for the case  
at hand.

<em>, <strong>, <i> and <b> have all been in HTML for over a decade.  
I think that’s long enough to see what happens in the wild. I think  
it is time to give up and admit that there are two pairs of visually- 
oriented synonyms instead of putting more time, effort, money, blog  
posts, spec examples and discussion threads into educating people  
about subtle differences in the hope that important benefits will be  
realized once people use these elements the “right” way.

Compare with: http://ln.hixie.ch/?start=1137799947&count=1


Incidentally, this morning I came across this:
http://www.elementary-group-standards.com/html/and-all-that-html5- 
malarkey.html

In particular, this caught my eye: “<b> has been deprecated.  
Replacing <b> with <strong> suffices.”

(I checked the schema, and, sure enough, <b> was not there. It turns  
out that it wasn’t in the spec when I last reviewed that part of the  
schema. It is in the spec now.)

My point here is that the reaction was to simply replace <b> with  
<strong>.


As for Safari, I have noticed even stranger behavior. See http:// 
hsivonen.iki.fi/kesakoodi/clipboard/

I think using span with a style attribute is a bad idea in this case.  
Italicizing a word or two in a paragraph is not incidental style that  
could easily be considered optional. It is a more essential part of  
the text that should be preserved when the content is formatted for a  
different display environment possibly with a different font. Hence,  
it makes sense to use an italicizing element.


P.S. I don’t believe semantic markup to be axiomatically better than  
presentational markup. Semantic markup shouldn’t be an end in itself.  
When semantic markup doesn't serve a useful end, such as media  
independence or particularly useful data mining, in *practice*, there  
is no point.

-- 
Henri Sivonen
hsivonen at iki.fi
http://hsivonen.iki.fi/





More information about the whatwg mailing list