Closed Bug 515821 Opened 15 years ago Closed 15 years ago

dataTransfer.types attribute needs to indicate presence of files on a drag

Categories

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

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- beta2-fixed

People

(Reporter: matinm1, Assigned: matinm1)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

Per the dataTransfer object spec here:

http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#dom-datatransfer-types

If the user includes any files in a drag, then the resulting DOMStringList object must contain the string "Files."
Attachment #399889 - Flags: superreview?(jonas)
Attachment #399889 - Flags: review?(enndeakin)
Hmm.. you should probably return the same list instance every time. I.e. store the created list in a member and return that if it's already set.

Neil: Would an alternative be to use "Files" instead of "application/x-moz-file" everywhere? Not sure what to do about file-promise though.
(In reply to comment #1)
> Hmm.. you should probably return the same list instance every time. I.e. store
> the created list in a member and return that if it's already set.

I don't see any reason to do that. This isn't performance sensitive code.

> Neil: Would an alternative be to use "Files" instead of
> "application/x-moz-file" everywhere? 

That would be a bit of a misnomer, since "application/x-moz-file" only represents one file.

The patch looks ok though, although I not sure if I like the idea of having a type that exists but getData will return nothing for.

I'd remove the file-promise part though, as dataTransfer.files doesn't check for it.
Comment on attachment 399889 [details] [diff] [review]
Patch for types attribute, v1

Talked it over with Neil, and I *think* I understand the file-promise stuff enough to say that this seems correct.

I guess caching the list object isn't important enough to spend the code that it would take to implement it.
Attachment #399889 - Flags: superreview?(jonas) → superreview+
Attachment #399889 - Flags: review?(enndeakin) → review+
Checked in:
http://hg.mozilla.org/mozilla-central/rev/bb262f3aee5d
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Now documented (for 1.9.3; if this lands into 1.9.2, re-mark as dev-doc-needed):

https://developer.mozilla.org/En/DragDrop/DataTransfer#types
Attachment #399889 - Flags: approval1.9.2? → approval1.9.2+
Landed on 1.9.2

http://hg.mozilla.org/releases/mozilla-1.9.2/rev/92a04292431c

Sheppy, can you adjust the docs to reflect that this is now available starting with 1.9.2?
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: