Closed Bug 572145 Opened 14 years ago Closed 14 years ago

HTMLInputElement files IDL attribute should throw an INVALID_STATE_ERR exception when its type is not file

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mounir, Assigned: mounir)

References

()

Details

(Keywords: html5)

Attachments

(1 file)

At the moment, we are only returning an empty file list if the type is not 'file'.
This may break some websites but I suppose .files should not be used really often whit non-file input. It may worth trying to land this to Minefield and see what happen.
Version: unspecified → Trunk
Attached patch Patch v1 (deleted) — Splinter Review
Attachment #451310 - Flags: review?(jonas)
Tested with success in the try server.
I actually, I think this is a bad idea. I'll raise it with the spec. We generally don't throw for any other properties that don't apply. In general throwing is a bit evil as people every so often iterate through all the properties using |for each|.
for each is our own extension, so it shouldn't break the web, right?

This logic seems to disfavor any form of state-validating getter, which seems extreme to me.
Surely there are cross-browser ways of iterating across all the properties of an object? Sorry if the "each" was mozilla specific.

Well, I agree that in some cases having state-validating getters makes sense. However given that there are sensible things to return here, and that precedence for all other properties that are type-specific, I think we should return a sensible value instead.

I sent a mail to the whatwg list, I suggest sending comments there.
Comment on attachment 451310 [details] [diff] [review]
Patch v1

I'm minusing this for now until we hear back otherwise from the WGs
Attachment #451310 - Flags: review?(jonas) → review-
Fixed in whatwg r5254 per Jonas comment.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: