Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery.event.props #3112

Closed
silverwind opened this issue May 10, 2016 · 2 comments
Closed

jQuery.event.props #3112

silverwind opened this issue May 10, 2016 · 2 comments

Comments

@silverwind
Copy link
Contributor

e61fccb removed jQuery.event.props which is still mentioned in this docs snippet:

// add the dataTransfer property for use with the native `drop` event
// to capture information about files dropped into the browser window
jQuery.event.props.push( "dataTransfer" );

If this change is intended to be breaking, I suggest pointing users to event.originalEvent.

@mgol
Copy link
Member

mgol commented May 10, 2016

This is an API site request so I'm closing it as a duplicate of jquery/api.jquery.com#405. That issue is quite old, though so it's good you reminded us about the change now being more needed than before; thanks!

@mgol mgol closed this as completed May 10, 2016
malles pushed a commit to uikit/uikit that referenced this issue Jun 16, 2016
 use e.originalEvent.dataTransfer as recommended (jquery/jquery#3112) event.props throws error on jQuery 3
 tested on jQ1.11.2, 2 and 3
@snowygman
Copy link

Hey,
I'm using var files = e.originalEvent.dataTransfer.files at the start of my drop function. The code was designed to read the file properties and keep adding it to a tabular list under the target area where the files are dropped. but it doesn't seem to hold all the files dropped unto the target area of my html page.
I replaced jQuery.event.props.push( "dataTransfer" ); with the code above, but it only seems to store the current file details in the File variable.
What I'm wondering is whether e.originalEvent.dataTransfer.files can stack my file details as a filelist, if I drop several files unto the target? I loop through the file variable and print a table of the file details, but I'm only able to retrieve the last file dropped.

$table = $('#fileInfo'), //grabs a DOM element in Jquery
            i = 0;
    $table.html('<thead><tr><th>Name</th><th>Type</th><th>Size</th></tr></thead>');
for (i = 0; i < files.length; i++) {
            $('<tr><td>'
            + files[i].name + '</td><td>'
            + files[i].type + '</td><td>'
            + files[i].size + '</td></tr>'). appendTo($table);
        }
        preventDefault(e);

Am I using the originalevent properly and what adjustments do I need to make to get my file variable to store multiple file details while the page is active?
Thanks for any assistance.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants