#26041 closed defect (bug) (fixed)
jshint shouldn't throw errors: wp-includes/js/plupload/handlers.js
Reported by: | mdbitz | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
jshint cleanup of wp-includes/js/plupload/handlers.js
W109 : Strings must use singlequote. W041 : Use '===' to compare with '0' W069 : ['resize'] is better written in dot notation W033 : Missing semicolon W014 : Bad line breaking before '+' W117 : ['post_id', 'pluploadL10n', 'resize_width', 'resize_height', 'shortform', 'ajaxurl', 'type', 'deleteUserSetting', 'setUserSetting', 'plupload'] is not defined
Attachments (1)
Change History (6)
#1
@
11 years ago
Hi i've been reviewing the code however I have some questions on the remaining items identified by jshint.
1) Should the following bind function be removed? or should it be wrapped in a jshint comment to ignore the error?
uploader.bind('BeforeUpload', function(up, file) { // something });
2) Should we remove parameters or add jshint ignore comments on items that are to-do items?
function deleteError(X, textStatus, errorThrown) { // TODO }
3) JShint is saying fileDialogStart and dndHelper are defined but not used. What is the correct metod to move ahead with clearing of these errors.
#2
@
11 years ago
This is an old file. Its structure (if you can call it that) came from swfupload/handlers.js. We copied that and then changed it up for Plupload in 3.3. In 3.4, a new API was written for the customizer, wp-includes/js/plupload/wp-plupload.js
. In 3.5, that API was updated and used for the new media library. So this is only used for media-new.php. It would be nice to eventually delete these files, for sure. With that in mind, it would be best if this file is left as pristine as possible for code spelunking purposes. So:
- Let's comment out the BeforeUpload.
- Let's remove the parameters. If we ignore the entire function, we'll then need to remove the reference to deleteError as well.
- Normally we would mark these as "exported". It looks like dndHelper is *not* from SWFUpload, and instead came from the project that added Plupload to core. It was accidental, essentially, and we can yank it. fileDialogStart was used only through 3.2 when we had SWFUpload; it was copied over to here in 3.3. Anyone trying to use it will be using the SWFUpload handlers, which includes a function of the same name. It can also be removed.
initial jshint cleanup