W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2007

[whatwg] De-emphasis

From: Arve Bersvendsen <arveb@opera.com>
Date: Fri, 09 Feb 2007 12:24:54 +0100
Message-ID: <op.tnhbbsjpbyn2jm@carnage>
On Fri, 09 Feb 2007 11:58:35 +0100, Mikko Rantalainen  
<mikko.rantalainen at peda.net> wrote:

> I believe that <aside> and <small> are different from de-emphasis (that  
> would be <dem> IMHO). However, the <dem> element wouldn't be that often  
> used and it would be vital for it to be easily implemented. A new  
> element with specified semantics and a simple default CSS style would be  
> a nice choice. An example *implementation* could be a single CSS rule:
>
> 	dem { opacity: 0.8 }
>
> How hard it would be to implement the behavior David described above?  
> Take any existing UA as a base.

If you are talking about making a backwards-compatible approach: Very  
cumbersome, as MSIE constructs a rather peculiar HTML DOM for elements it  
doesn't recognize. Compare this example:  
<URL:http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0D%0A%3Chtml%3E%0D%0A%3Cp%3ESome%20%3Cdem%3Ede-emphasized%3C/dem%3E%20text%3C/p%3E>  
in MSIE and other browsers:

IE makes two empty elements, whose tag names are 'dem' and '/dem'  
respectively. While this may often be of little consequence for a rendered  
view and you don't attempt to change the value of CSS display:, it may  
wreak havoc in scripting scenarios.

Confusingly enough, if try to create the document tree with scripting,  
using something like ...

var p = document.createElement('p')
p.appendChild(document.createTextNode('Some '));
var dem = document.createElement('dem');
dem.appendChild(document.createTextNode('de-emphasized'));
p.appendChild(dem);
document.appendChild(document.createTextNode(' text');

... MSIE will create the correct document tree. Amusing, isn't it?


Note that this is a general problem with all new non-empty elements  
introduced in HTML5, they will break any scenario in which the DOM is to  
be scripted, or require separate code paths for autocorrecting the DOM in  
those browsers.

-- 
Arve Bersvendsen, Web Applications Developer

Opera Software ASA, http://www.opera.com/
Received on Friday, 9 February 2007 03:24:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:32 UTC