[whatwg] Don't throw for HTMLInputElement.files

Jonas Sicking jonas at sicking.cc
Tue Jun 15 11:25:21 PDT 2010

Hi All,

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.

/ Jonas

More information about the whatwg mailing list