[whatwg] [html5] attributes in text/html

Ian Hickson ian at hixie.ch
Thu May 24 12:37:24 PDT 2007

On Fri, 30 Sep 2005, Anne van Kesteren wrote:
> I tested attribute parsing, createAttribute and setAttribute in Opera, Firefox
> and Internet Explorer.
>  <http://annevankesteren.nl/test/dom/html/attr/001>
>  <http://annevankesteren.nl/test/dom/html/attr/002>
>  <http://annevankesteren.nl/test/dom/html/attr/003>
> It seems that Firefox lowercases all unknown and known attributes. It 
> seems that Opera and Internet Explorer lowercase all known attributes 
> unless they are created using createAttribute. Opera and Internet 
> Explorer do not touch unknown attributes.

What Opera does is more complex than that actually. For example it turns 
this [1]:

   <!DOCTYPE html>
   <p tesT=a TEST=a TeSt=a test=a>

...into this:

   <p tesT="a" tesT="a" tesT="a" tesT="a">

...which makes no sense.

IE also returns four attributes for this, which would require the 
tokeniser to have element-specific knowledge, which I really don't think 
is a good idea.

In the DOM, though, we want XML and HTML to be as close to each other as 
possible. I think the current rules in the spec are as good as we can get 

(Given the lack of interoperability here we have some flexibility.)

[1] http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%3Cp%20tesT%3Da%20TEST%3Da%20TeSt%3Da%20test%3Da%3E

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list