[whatwg] Why [PutForwards=value] for htmlFor output element attribute ?

Ian Hickson ian at hixie.ch
Tue Jul 27 16:49:08 PDT 2010


On Mon, 5 Apr 2010, Mounir Lamouri wrote:
> 
> I'm wondering why the [PutForwards=value] extended attribute is needed 
> for the htmlFor output element attribute ?

It's an attempt to make it work the same as <label>'s htmlFor, while still 
supporting the new token-based API.


On Thu, 8 Apr 2010, Olli Pettay wrote:
> 
> I agree. In general PutForwards makes APIs strange, IMO Location is a 
> good example of a pretty awkward API. In the case of output element, 
> element.htmlFor.value = "Something" isn't really more difficult than 
> element.htmlFor = "something";

True, but it would mean that it is inconsistent with <label> in a weird 
way.


> It is a bit ugly that one .htmlFor is DOMSettableTokenList,
> but other .htmlFors are DOMStrings

Yeah. I'd love to change the other ones; is that safe? I've been relucant 
to risk it so far.


> Btw why doesn't .classList have PutForwards
> (in which case it could use DOMSettableTokenList)

To set it, use className. I'd have liked to just make className into a 
DOMSettableTokenList, but that would mean it was no longer a String 
object, and while changing htmlFor might be safe, I'm almost certain 
changing className would not be.


On Tue, 13 Apr 2010, Magnus Kristiansen wrote:
> 
> You could argue that every DOMSettableTokenList should have 
> PutForwards=value behavior by default, since it already forwards on 
> getting.

I don't think you can do that in WebIDL currently.

-- 
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