[whatwg] Toggling Attributes

On Sun, 22 Mar 2009, Christoph P?per wrote:
> Ian Hickson (2009-02-13):
> > There are three of these attributes so far:
> > 
> >   autocomplete = on/off
> >   contenteditable = true/false
> >   draggable = true/false
> 
> It would be nice, actually, from an author perspective at least, if all 
> of these worked for all applicable attributes:
> 
>   <foo bar>
>   <foo bar=bar>
>   <foo bar=on>
>   <foo bar=true>
>   <foo bar=1>*
> 
>   <foo>*
>   <foo bar="">*
>   <foo bar=off>
>   <foo bar=false>
>   <foo bar=0>*
> 
> * I am not completely sure about the ones marked with an asterisk, 
> because digits may not be necessary and the default or inherited state 
> may be 'enabled'.

Unfortunately we really can't change this at this point, many of these 
attributes are widely deployed. The reason some of the attribute have 
true/false is that they also have other states, like "inherit" or "auto" 
that happen when the attribute is absent. The truly boolean ones are all 
just based on their presence, and their value is ignored. This is 
preferable as it is much quicker to test and is thus more performant.

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

Received on Monday, 27 April 2009 22:06:32 UTC