diff --git a/js/i18n.js b/js/i18n.js
index 251a8b7..5d33ea4 100644
--- a/js/i18n.js
+++ b/js/i18n.js
@@ -4,18 +4,18 @@
  */
 
 // Add translations.
-plupload.addI18n({
-  "Select files" : Drupal.t("Select files"),
-  "Add files to the upload queue and click the start button." : Drupal.t("Add files to the upload queue and click the start button."),
-  "Filename" : Drupal.t("Filename"),
-  "Status" : Drupal.t("Status"),
-  "Size" : Drupal.t("Size"),
-  "Add files" : Drupal.t("Add files"),
-  "Stop current upload" : Drupal.t("Stop current upload"),
-  "Start uploading queue" : Drupal.t("Start uploading queue"),
+Drupal.plupload.addI18n({
+  "Select files": Drupal.t("Select files"),
+  "Add files to the upload queue and click the start button.": Drupal.t("Add files to the upload queue and click the start button."),
+  "Filename": Drupal.t("Filename"),
+  "Status": Drupal.t("Status"),
+  "Size": Drupal.t("Size"),
+  "Add files": Drupal.t("Add files"),
+  "Stop current upload": Drupal.t("Stop current upload"),
+  "Start uploading queue": Drupal.t("Start uploading queue"),
   "Uploaded %d/%d files": Drupal.t("Uploaded %d/%d files"),
-  "N/A" : Drupal.t("N/A"),
-  "Drag files here." : Drupal.t("Drag files here."),
+  "N/A": Drupal.t("N/A"),
+  "Drag files here.": Drupal.t("Drag files here."),
   "File extension error.": Drupal.t("File extension error."),
   "File size error.": Drupal.t("File size error."),
   "Init error.": Drupal.t("Init error."),
@@ -23,7 +23,7 @@ plupload.addI18n({
   "Security error.": Drupal.t("Security error."),
   "Generic error.": Drupal.t("Generic error."),
   "IO error.": Drupal.t("IO error."),
-  "Start upload" : Drupal.t("Start upload"),
-  "Stop upload" : Drupal.t("Stop upload"),
-  "%d files queued" : Drupal.t("%d files queued")
+  "Start upload": Drupal.t("Start upload"),
+  "Stop upload": Drupal.t("Stop upload"),
+  "%d files queued": Drupal.t("%d files queued")
 });
diff --git a/plupload.js b/plupload.js
index 0a9d56e..087d2d5 100644
--- a/plupload.js
+++ b/plupload.js
@@ -1,11 +1,11 @@
-(function($) {
-
-Drupal.plupload = Drupal.plupload || {};
+(function ($) {
+  'use strict';
+  Drupal.plupload = Drupal.plupload || {};
 // Add Plupload events for autoupload and autosubmit.
-Drupal.plupload.filesAddedCallback = function (up, files) {
-  setTimeout(function(){up.start()}, 100);
+  Drupal.plupload.filesAddedCallback = function (up, files) {
+  setTimeout(function () {up.start();}, 100);
 };
-Drupal.plupload.uploadCompleteCallback = function(up, files) {
+  Drupal.plupload.uploadCompleteCallback = function (up, files) {
   var $this = $("#"+up.settings.container);
   // If there is submit_element trigger it.
   var submit_element = drupalSettings.plupload[$this.attr('id')].submit_element;
@@ -15,13 +15,13 @@ Drupal.plupload.uploadCompleteCallback = function(up, files) {
   // Otherwise submit default form.
   else {
     var $form = $this.parents('form');
-      $($form[0]).submit();
+    $($form[0]).submit();
   }
 };
 /**
  * Attaches the Plupload behavior to each Plupload form element.
  */
-Drupal.behaviors.plupload = {
+  Drupal.behaviors.plupload = {
   attach: function (context, settings) {
     $(".plupload-element", context).once('plupload-init').each(function () {
       var $this = $(this);
@@ -65,23 +65,25 @@ Drupal.behaviors.plupload = {
           pluploadSettings.init = {};
         }
         for (var key in elementSettings['init']) {
-          var callback = elementSettings['init'][key].split('.');
-          var fn = window;
-          for (var j = 0; j < callback.length; j++) {
-            if (typeof (fn[callback[j]]) != "undefined") {
-              fn = fn[callback[j]];
+          if (elementSettings['init'].hasOwnProperty(key)) {
+            var callback = elementSettings['init'][key].split('.');
+            var fn = window;
+            for (var j = 0; j < callback.length; j++) {
+              if (typeof (fn[callback[j]]) != "undefined") {
+                fn = fn[callback[j]];
             }
-            else {
+              else {
               // Drupal.announce might be introduced in 8.1
               // https://www.drupal.org/node/77245
-              if (Drupal.announce) {
-                Drupal.announce('Plupload callback not defined: ' + fn + '.' + callback[j]);
+                if (Drupal.announce) {
+                  Drupal.announce('Plupload callback not defined: ' + fn + '.' + callback[j]);
+                }
+                break;
               }
-              break;
             }
-          }
-          if (typeof fn === 'function') {
-            pluploadSettings.init[key] = fn;
+            if (typeof fn === 'function') {
+              pluploadSettings.init[key] = fn;
+            }
           }
         }
       }
@@ -95,9 +97,9 @@ Drupal.behaviors.plupload = {
  /**
   * Attaches the Plupload behavior to each Plupload form element.
   */
-Drupal.behaviors.pluploadform = {
-  attach: function(context, settings) {
-    $('form', context).once('plupload-form').each(function() {
+  Drupal.behaviors.pluploadform = {
+  attach: function (context, settings) {
+    $('form', context).once('plupload-form').each(function () {
       if (0 < $(this).find('.plupload-element').length) {
         var $form = $(this);
         var originalFormAttributes = {
@@ -107,12 +109,12 @@ Drupal.behaviors.pluploadform = {
             'target': $form.attr('target')
         };
 
-        $(this).submit(function(e) {
+        $(this).submit(function (e) {
           var completedPluploaders = 0;
           var totalPluploaders = $(this).find('.plupload-element').length;
           var errors = '';
 
-          $(this).find('.plupload-element').each( function(index){
+          $(this).find('.plupload-element').each(function (index) {
             var uploader = $(this).pluploadQueue();
 
             var id = $(this).attr('id');
@@ -120,36 +122,38 @@ Drupal.behaviors.pluploadform = {
             var elementSettings = (id && settings.plupload[id]) ? settings.plupload[id] : {};
             var pluploadSettings = $.extend({}, defaultSettings, elementSettings);
 
-            //Only allow the submit to proceed if there are files and they've all
-            //completed uploading.
-            //TODO: Implement a setting for whether the field is required, rather
-            //than assuming that all are.
-            if (uploader.state == plupload.STARTED) {
+            // Only allow the submit to proceed if there are files and they've all
+            // completed uploading.
+            // TODO: Implement a setting for whether the field is required, rather
+            // than assuming that all are.
+            if (uploader.state === pluploadSettings.STARTED) {
               errors += Drupal.t("Please wait while your files are being uploaded.");
             }
-            else if (uploader.files.length == 0 && !pluploadSettings.required) {
+            else if (uploader.files.length === 0 && !pluploadSettings.required) {
               completedPluploaders++;
             }
 
-            else if (uploader.files.length == 0) {
+            else if (uploader.files.length === 0) {
               errors += Drupal.t("@index: You must upload at least one file.\n",{'@index': (index + 1)});
             }
 
-            else if (uploader.files.length > 0 && uploader.total.uploaded == uploader.files.length) {
+            else if (uploader.files.length > 0 && uploader.total.uploaded === uploader.files.length) {
               completedPluploaders++;
             }
 
             else {
-              var stateChangedHandler = function() {
-                if (uploader.total.uploaded == uploader.files.length) {
+              var stateChangedHandler = function () {
+                if (uploader.total.uploaded === uploader.files.length) {
                   uploader.unbind('StateChanged', stateChangedHandler);
                   completedPluploaders++;
-                  if (completedPluploaders == totalPluploaders ) {
-                    //Plupload's html4 runtime has a bug where it changes the
-                    //attributes of the form to handle the file upload, but then
-                    //fails to change them back after the upload is finished.
+                  if (completedPluploaders === totalPluploaders) {
+                    // Plupload's html4 runtime has a bug where it changes the
+                    // attributes of the form to handle the file upload, but then
+                    // fails to change them back after the upload is finished.
                     for (var attr in originalFormAttributes) {
-                      $form.attr(attr, originalFormAttributes[attr]);
+                      if (originalFormAttributes.hasOwnProperty(attr)) {
+                        $form.attr(attr, originalFormAttributes[attr]);
+                      }
                     }
                     // Click a specific element if one is specified.
                     if (settings.plupload[id].submit_element) {
@@ -167,16 +171,18 @@ Drupal.behaviors.pluploadform = {
             }
 
           });
-          if (completedPluploaders == totalPluploaders) {
-            //Plupload's html4 runtime has a bug where it changes the
-            //attributes of the form to handle the file upload, but then
-            //fails to change them back after the upload is finished.
+          if (completedPluploaders === totalPluploaders) {
+            // Plupload's html4 runtime has a bug where it changes the
+            // attributes of the form to handle the file upload, but then
+            // fails to change them back after the upload is finished.
             for (var attr in originalFormAttributes) {
-              $form.attr(attr, originalFormAttributes[attr]);
+              if (originalFormAttributes.hasOwnProperty(attr)) {
+                $form.attr(attr, originalFormAttributes[attr]);
+              }
             }
             return true;
           }
-          else if (0 < errors.length){
+          else if (0 < errors.length) {
             alert(errors);
           }
 
@@ -196,19 +202,19 @@ Drupal.behaviors.pluploadform = {
  *   - A positive integer if a > b.
  *   - 0 if a == b.
  */
-Drupal.plupload.compareVersions = function (a, b) {
+  Drupal.plupload.compareVersions = function (a, b) {
   a = a.split('.');
   b = b.split('.');
   // Return the most significant difference, if there is one.
   for (var i=0; i < Math.min(a.length, b.length); i++) {
     var compare = parseInt(a[i]) - parseInt(b[i]);
-    if (compare != 0) {
+    if (compare !== 0) {
       return compare;
     }
   }
   // If the common parts of the two version strings are equal, the greater
   // version number is the one with the most sections.
   return a.length - b.length;
-}
+};
 
 })(jQuery);
