[whatwg] Setting .value on <input type=file>

Jonas Sicking jonas at sicking.cc
Tue Sep 15 18:44:19 PDT 2009


Hi All,

Currently the spec says to throw an INVALID_ACCESS_ERR exception
anytime the 'value' IDL attribute is set. However allowing it to be
set to the empty string would be good.

The simplest use case is allowing the page to implement a 'cancel'
button. Many UAs (in fact all that I know of) don't have explicit UI
for clearing the field. In fact a quick test shows that at least
Firefox and Safari has no way to clear the field at all.

While the page can always delete the old input element and create a
new one, that is much more complicated. Especially if the element has
event listeners or user data associated with it.

Setting it to the empty string works in Firefox, Safari, and Chrome.
It does not appear to work in IE or Opera.

/ Jonas


More information about the whatwg mailing list