[whatwg] Custom elements and attributes

Øistein E. Andersen html5 at xn--istein-9xa.com
Tue Oct 17 15:27:20 PDT 2006


Hello, 

I just tried to check out how custom element and attribute names work in current browsers and how they are supposed to work in HTML5, and some issues seem unclear to me. Given the following fairly minimal document:

> <!DOCTYPE html>
> <html xmlns:x="">
> <title>HTML 5</title>
> <style type="text/css">
>     x\:red    { background-color: red; }
>     x\:blue   { color: blue; }
>     x\:r\f4le { border: 4px solid green; }
> </style>
> <p><x:red x-attribute=value>red <x:blue>blue</x:red>
> <p>black <x:rôle>rôle</x:rôle> black

1) Firefox renders this as intended, i.e., `red blue' on a red background, `blue' in blue and the rest of the text in black, `rôle' surronded by a green frame.

2) Safari does the same, except that Unicode characters (i.e., the accented o in rôle in this example) are not treated correctly.

3) Opera and IE6 both fail to close x:blue when the containing element x:red is closed; therefore, the second line `black rôle black' is rendered in blue. I think the current HTML5 draft requires all custom elements to be explicitly closed, and I accept this as reasonable although I would have preferred constructions like <foo>x<bar>y</foo> to be made well-formed and equivalent to <foo>x<bar>y</bar></foo>.

4) Sivonen's HTML5 validator (http://hsivonen.iki.fi/validator/html5/ as opposed to http://hsivonen.iki.fi/validator/) says: 
> Attribute name must not start with “xml”.
I fail to find any mention of this in the HTML5 draft. Has it been borrowed from X(HT)ML?
Such a limitation would make it more difficult to create conformant legacy-comptaible documents.

5) The same validator does not allow : or ô in either element or attribute names, whereas the current HTML5 draft seems to allow all Unicode characters except whitespace, <, >, = and /. Would someone please clarify this?

6) According to the current draft, authors seem to have the possibility to use custom element and attribute names of their choice. I do not really want this to change, but I would suggest that names starting with x- and x: be explicitly reserved for custom elements and attributes and thus effectively removed from the HTML namespace. This would be similar to the use of x- in language tags as defined in RFC 4646 and could be extended to attribute values taken from a list of possible values defined in the HTML standard.

-- 
Øistein E. Andersen



More information about the whatwg mailing list