[whatwg] De-emphasis
Arve Bersvendsen
arveb at opera.com
Fri Feb 9 03:24:54 PST 2007
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/
More information about the whatwg
mailing list