[whatwg] Don't throw for HTMLInputElement.files

Ian Hickson ian at hixie.ch
Mon Aug 9 15:35:16 PDT 2010


On Tue, 15 Jun 2010, Jonas Sicking wrote:
> 
> Currently HTMLInputElement.files throws if accessed when type != "file". 
> I think it would be better to return null or an empty list. We generally 
> try to avoid throwing in general, and in particular things like 
> HTMLInputElement.checked doesn't throw even if the value doesn't apply. 
> So for consistency I don't think HTMLInputElement.files should throw 
> either.
> 
> Another reason not to throw is that people every so often enumerate all 
> the IDL attributes of element using |for each| constructs in javascript. 
> Such code tends to break if there are properties that throw upon access.

Changed.

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