From bd30dbfc09eab7438f7ca4a60a4abeaddf49fbf2 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Tue, 8 May 2012 11:57:33 +0900
Subject: [PATCH] Issue #1481560 by nod_: Add 'use strict' to all core
 JavaScript to enforce clean code.

---
 core/misc/ajax.js                         | 2 ++
 core/misc/authorize.js                    | 3 ++-
 core/misc/autocomplete.js                 | 2 ++
 core/misc/batch.js                        | 2 ++
 core/misc/collapse.js                     | 2 ++
 core/misc/drupal.js                       | 2 ++
 core/misc/form.js                         | 2 ++
 core/misc/machine-name.js                 | 2 ++
 core/misc/progress.js                     | 2 ++
 core/misc/states.js                       | 2 ++
 core/misc/tabledrag.js                    | 2 ++
 core/misc/tableheader.js                  | 2 ++
 core/misc/tableselect.js                  | 2 ++
 core/misc/timezone.js                     | 2 ++
 core/misc/vertical-tabs.js                | 2 ++
 core/modules/block/block.js               | 2 ++
 core/modules/book/book.js                 | 2 ++
 core/modules/color/color.js               | 2 ++
 core/modules/color/preview.js             | 3 +++
 core/modules/comment/comment-node-form.js | 2 ++
 core/modules/contextual/contextual.js     | 2 ++
 core/modules/dashboard/dashboard.js       | 2 ++
 core/modules/field/modules/text/text.js   | 2 ++
 core/modules/field_ui/field_ui.js         | 2 ++
 core/modules/file/file.js                 | 2 ++
 core/modules/filter/filter.admin.js       | 2 ++
 core/modules/filter/filter.js             | 2 ++
 core/modules/locale/locale.datepicker.js  | 2 ++
 core/modules/menu/menu.admin.js           | 2 ++
 core/modules/menu/menu.js                 | 2 ++
 core/modules/node/content_types.js        | 2 ++
 core/modules/node/node.js                 | 2 ++
 core/modules/openid/openid.js             | 2 ++
 core/modules/overlay/overlay-child.js     | 2 ++
 core/modules/overlay/overlay-parent.js    | 2 ++
 core/modules/path/path.js                 | 2 ++
 core/modules/shortcut/shortcut.admin.js   | 2 ++
 core/modules/simpletest/simpletest.js     | 2 ++
 core/modules/statistics/statistics.js     | 3 +++
 core/modules/system/system.cron.js        | 2 ++
 core/modules/system/system.js             | 2 ++
 core/modules/taxonomy/taxonomy.js         | 2 ++
 core/modules/toolbar/toolbar.js           | 2 ++
 core/modules/user/user.js                 | 3 +++
 core/modules/user/user.permissions.js     | 2 ++
 core/themes/bartik/color/preview.js       | 4 +++-
 46 files changed, 96 insertions(+), 2 deletions(-)

diff --git a/core/misc/ajax.js b/core/misc/ajax.js
index 072cd2bf6603..d599799ae679 100644
--- a/core/misc/ajax.js
+++ b/core/misc/ajax.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Provides Ajax page updating via jQuery $.ajax (Asynchronous JavaScript and XML).
  *
diff --git a/core/misc/authorize.js b/core/misc/authorize.js
index d522a5ba9be4..aa4575d83751 100644
--- a/core/misc/authorize.js
+++ b/core/misc/authorize.js
@@ -1,4 +1,3 @@
-
 /**
  * @file
  * Conditionally hide or show the appropriate settings and saved defaults
@@ -7,6 +6,8 @@
 
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.authorizeFileTransferForm = {
   attach: function(context) {
     $('#edit-connection-settings-authorize-filetransfer-default').change(function() {
diff --git a/core/misc/autocomplete.js b/core/misc/autocomplete.js
index a4f63354f906..8b0dd7237f17 100644
--- a/core/misc/autocomplete.js
+++ b/core/misc/autocomplete.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Attaches the autocomplete behavior to all required fields.
  */
diff --git a/core/misc/batch.js b/core/misc/batch.js
index 6d28b69ad1f3..b83776dd1f62 100644
--- a/core/misc/batch.js
+++ b/core/misc/batch.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Attaches the batch behavior to progress bars.
  */
diff --git a/core/misc/collapse.js b/core/misc/collapse.js
index 28281a1cb4ac..b484a6fce3eb 100644
--- a/core/misc/collapse.js
+++ b/core/misc/collapse.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Toggle the visibility of a fieldset using smooth animations.
  */
diff --git a/core/misc/drupal.js b/core/misc/drupal.js
index 5bbbf511023e..43a78f3f0629 100644
--- a/core/misc/drupal.js
+++ b/core/misc/drupal.js
@@ -5,6 +5,8 @@ jQuery.noConflict();
 
 (function ($) {
 
+"use strict";
+
 /**
  * Attach all registered behaviors to a page element.
  *
diff --git a/core/misc/form.js b/core/misc/form.js
index 4dc5b8c8bf3e..0e7cf7b13596 100644
--- a/core/misc/form.js
+++ b/core/misc/form.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Retrieves the summary for the first element.
  */
diff --git a/core/misc/machine-name.js b/core/misc/machine-name.js
index ffe774f91018..3cb7351cac77 100644
--- a/core/misc/machine-name.js
+++ b/core/misc/machine-name.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Attach the machine-readable name form element behavior.
  */
diff --git a/core/misc/progress.js b/core/misc/progress.js
index b0e125cf32a6..343b9ad82031 100644
--- a/core/misc/progress.js
+++ b/core/misc/progress.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * A progressbar object. Initialized with the given id. Must be inserted into
  * the DOM afterwards through progressBar.element.
diff --git a/core/misc/states.js b/core/misc/states.js
index 955e8625b815..fa7a10175234 100644
--- a/core/misc/states.js
+++ b/core/misc/states.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * The base States namespace.
  *
diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js
index 16800e034280..273dcc1b28e8 100644
--- a/core/misc/tabledrag.js
+++ b/core/misc/tabledrag.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Drag and drop table rows with field manipulation.
  *
diff --git a/core/misc/tableheader.js b/core/misc/tableheader.js
index aa1c8bb4588b..225cb7305bad 100644
--- a/core/misc/tableheader.js
+++ b/core/misc/tableheader.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Attaches sticky table headers.
  */
diff --git a/core/misc/tableselect.js b/core/misc/tableselect.js
index b7011e0eea1b..2bf708efab69 100644
--- a/core/misc/tableselect.js
+++ b/core/misc/tableselect.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.tableSelect = {
   attach: function (context, settings) {
     // Select the inner-most table in case of nested tables.
diff --git a/core/misc/timezone.js b/core/misc/timezone.js
index 6f82bc1d3eae..29a6650a4498 100644
--- a/core/misc/timezone.js
+++ b/core/misc/timezone.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Set the client's system time zone as default values of form fields.
  */
diff --git a/core/misc/vertical-tabs.js b/core/misc/vertical-tabs.js
index 65e56831984c..baae1d137b32 100644
--- a/core/misc/vertical-tabs.js
+++ b/core/misc/vertical-tabs.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * This script transforms a set of fieldsets into a stack of vertical
  * tabs. Another tab pane can be selected by clicking on the respective
diff --git a/core/modules/block/block.js b/core/modules/block/block.js
index dabb5701a51f..e20001714e52 100644
--- a/core/modules/block/block.js
+++ b/core/modules/block/block.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Provide the summary information for the block settings vertical tabs.
  */
diff --git a/core/modules/book/book.js b/core/modules/book/book.js
index e6ab4facb96d..b7a6713faa86 100644
--- a/core/modules/book/book.js
+++ b/core/modules/book/book.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.bookFieldsetSummaries = {
   attach: function (context) {
     $(context).find('fieldset.book-outline-form').drupalSetSummary(function (context) {
diff --git a/core/modules/color/color.js b/core/modules/color/color.js
index d833a4b7177e..31c526e79db3 100644
--- a/core/modules/color/color.js
+++ b/core/modules/color/color.js
@@ -5,6 +5,8 @@
 
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.color = {
   attach: function (context, settings) {
     var i, j, colors, field_name;
diff --git a/core/modules/color/preview.js b/core/modules/color/preview.js
index 69c3897a7621..9e1998515ce7 100644
--- a/core/modules/color/preview.js
+++ b/core/modules/color/preview.js
@@ -4,6 +4,9 @@
  */
 
 (function ($) {
+
+  "use strict";
+
   Drupal.color = {
     callback: function(context, settings, form, farb, height, width) {
       // Solid background.
diff --git a/core/modules/comment/comment-node-form.js b/core/modules/comment/comment-node-form.js
index 51ea49256907..0249d96dadc8 100644
--- a/core/modules/comment/comment-node-form.js
+++ b/core/modules/comment/comment-node-form.js
@@ -5,6 +5,8 @@
 
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.commentFieldsetSummaries = {
   attach: function (context) {
     var $context = $(context);
diff --git a/core/modules/contextual/contextual.js b/core/modules/contextual/contextual.js
index 5c477264fd9d..3b7aeeb50891 100644
--- a/core/modules/contextual/contextual.js
+++ b/core/modules/contextual/contextual.js
@@ -5,6 +5,8 @@
 
 (function ($) {
 
+"use strict";
+
 Drupal.contextualLinks = Drupal.contextualLinks || {};
 
 /**
diff --git a/core/modules/dashboard/dashboard.js b/core/modules/dashboard/dashboard.js
index 39d87c20e9cd..e1a43e02fa87 100644
--- a/core/modules/dashboard/dashboard.js
+++ b/core/modules/dashboard/dashboard.js
@@ -5,6 +5,8 @@
 
 (function ($) {
 
+"use strict";
+
 /**
  * Implements Drupal.behaviors for the Dashboard module.
  */
diff --git a/core/modules/field/modules/text/text.js b/core/modules/field/modules/text/text.js
index 01a49a738afe..efc5579fc5af 100644
--- a/core/modules/field/modules/text/text.js
+++ b/core/modules/field/modules/text/text.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Auto-hide summary textarea if empty and show hide and unhide links.
  */
diff --git a/core/modules/field_ui/field_ui.js b/core/modules/field_ui/field_ui.js
index 6de5c1543897..87c10910c9a3 100644
--- a/core/modules/field_ui/field_ui.js
+++ b/core/modules/field_ui/field_ui.js
@@ -5,6 +5,8 @@
  
 (function($) {
 
+"use strict";
+
 Drupal.behaviors.fieldUIFieldOverview = {
   attach: function (context, settings) {
     $(context).find('table#field-overview').once('field-overview', function () {
diff --git a/core/modules/file/file.js b/core/modules/file/file.js
index a934afe2d7ec..cec3fe8ccbab 100644
--- a/core/modules/file/file.js
+++ b/core/modules/file/file.js
@@ -9,6 +9,8 @@
 
 (function ($) {
 
+"use strict";
+
 /**
  * Attach behaviors to managed file element upload fields.
  */
diff --git a/core/modules/filter/filter.admin.js b/core/modules/filter/filter.admin.js
index 43cda26ef565..b002041acdbd 100644
--- a/core/modules/filter/filter.admin.js
+++ b/core/modules/filter/filter.admin.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.filterStatus = {
   attach: function (context, settings) {
     var $context = $(context);
diff --git a/core/modules/filter/filter.js b/core/modules/filter/filter.js
index db5f42a4927c..948273791fc7 100644
--- a/core/modules/filter/filter.js
+++ b/core/modules/filter/filter.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Automatically display the guidelines of the selected text format.
  */
diff --git a/core/modules/locale/locale.datepicker.js b/core/modules/locale/locale.datepicker.js
index 81f1e17b3cff..024c1e291c1e 100644
--- a/core/modules/locale/locale.datepicker.js
+++ b/core/modules/locale/locale.datepicker.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 $.datepicker.regional['drupal-locale'] = {
   closeText: Drupal.t('Done'),
   prevText: Drupal.t('Prev'),
diff --git a/core/modules/menu/menu.admin.js b/core/modules/menu/menu.admin.js
index 42d69d533e12..8bbb6ad54136 100644
--- a/core/modules/menu/menu.admin.js
+++ b/core/modules/menu/menu.admin.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.menuChangeParentItems = {
   attach: function (context, settings) {
     $('fieldset#edit-menu input').each(function () {
diff --git a/core/modules/menu/menu.js b/core/modules/menu/menu.js
index f315e7aa78e5..f3bfb1c874b5 100644
--- a/core/modules/menu/menu.js
+++ b/core/modules/menu/menu.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.menuFieldsetSummaries = {
   attach: function (context) {
     $(context).find('fieldset.menu-link-form').drupalSetSummary(function (context) {
diff --git a/core/modules/node/content_types.js b/core/modules/node/content_types.js
index 43cfa378829d..5c1c44e0f157 100644
--- a/core/modules/node/content_types.js
+++ b/core/modules/node/content_types.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.contentTypes = {
   attach: function (context) {
     var $context = $(context);
diff --git a/core/modules/node/node.js b/core/modules/node/node.js
index 899016408d5b..0899d3c50cb0 100644
--- a/core/modules/node/node.js
+++ b/core/modules/node/node.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.nodeFieldsetSummaries = {
   attach: function (context) {
     var $context = $(context);
diff --git a/core/modules/openid/openid.js b/core/modules/openid/openid.js
index 754efb157f66..53a0cb3d5881 100644
--- a/core/modules/openid/openid.js
+++ b/core/modules/openid/openid.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.openid = {
   attach: function (context) {
     var $context = $(context);
diff --git a/core/modules/overlay/overlay-child.js b/core/modules/overlay/overlay-child.js
index ff111d89d4bb..29a979012516 100644
--- a/core/modules/overlay/overlay-child.js
+++ b/core/modules/overlay/overlay-child.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Attach the child dialog behavior to new content.
  */
diff --git a/core/modules/overlay/overlay-parent.js b/core/modules/overlay/overlay-parent.js
index aa90d9bb5069..6537cb640f2a 100644
--- a/core/modules/overlay/overlay-parent.js
+++ b/core/modules/overlay/overlay-parent.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Open the overlay, or load content into it, when an admin link is clicked.
  */
diff --git a/core/modules/path/path.js b/core/modules/path/path.js
index b20378e1da82..41b6e8f8e9b3 100644
--- a/core/modules/path/path.js
+++ b/core/modules/path/path.js
@@ -4,6 +4,8 @@
  */
 (function ($) {
 
+"use strict";
+
 Drupal.behaviors.pathFieldsetSummaries = {
   attach: function (context) {
     $(context).find('fieldset.path-form').drupalSetSummary(function (context) {
diff --git a/core/modules/shortcut/shortcut.admin.js b/core/modules/shortcut/shortcut.admin.js
index 2647f343e1ac..4530df52f923 100644
--- a/core/modules/shortcut/shortcut.admin.js
+++ b/core/modules/shortcut/shortcut.admin.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Handle the concept of a fixed number of slots.
  *
diff --git a/core/modules/simpletest/simpletest.js b/core/modules/simpletest/simpletest.js
index 2199fede78cb..1e2d2465d142 100644
--- a/core/modules/simpletest/simpletest.js
+++ b/core/modules/simpletest/simpletest.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Add the cool table collapsing on the testing overview page.
  */
diff --git a/core/modules/statistics/statistics.js b/core/modules/statistics/statistics.js
index 65793d36e646..5618c55f2d5a 100644
--- a/core/modules/statistics/statistics.js
+++ b/core/modules/statistics/statistics.js
@@ -1,4 +1,7 @@
 (function ($) {
+
+  "use strict";
+
   $(document).ready(function() {
     var nid = Drupal.settings.statistics.nid;
     var basePath = Drupal.settings.basePath
diff --git a/core/modules/system/system.cron.js b/core/modules/system/system.cron.js
index aa5b35113860..0686982dc3af 100644
--- a/core/modules/system/system.cron.js
+++ b/core/modules/system/system.cron.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Checks to see if the cron should be automatically run.
  */
diff --git a/core/modules/system/system.js b/core/modules/system/system.js
index ab00426b2024..03bee22de061 100644
--- a/core/modules/system/system.js
+++ b/core/modules/system/system.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Show/hide the 'Email site administrator when updates are available' checkbox
  * on the install page.
diff --git a/core/modules/taxonomy/taxonomy.js b/core/modules/taxonomy/taxonomy.js
index 035dc29640e3..0fe6e9a9e9f2 100644
--- a/core/modules/taxonomy/taxonomy.js
+++ b/core/modules/taxonomy/taxonomy.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Move a block in the blocks table from one region to another via select list.
  *
diff --git a/core/modules/toolbar/toolbar.js b/core/modules/toolbar/toolbar.js
index d34528414609..ee8bddbdc62c 100644
--- a/core/modules/toolbar/toolbar.js
+++ b/core/modules/toolbar/toolbar.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 Drupal.toolbar = Drupal.toolbar || {};
 
 /**
diff --git a/core/modules/user/user.js b/core/modules/user/user.js
index 59a178e89e11..147c4c2a7bb3 100644
--- a/core/modules/user/user.js
+++ b/core/modules/user/user.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Attach handlers to evaluate the strength of any password fields and to check
  * that its confirmation is correct.
@@ -157,6 +159,7 @@ Drupal.evaluatePasswordStrength = function (password, translate) {
     strength = 5;
   }
 
+  var indicatorText;
   // Based on the strength, work out what text should be shown by the password strength meter.
   if (strength < 60) {
     indicatorText = translate.weak;
diff --git a/core/modules/user/user.permissions.js b/core/modules/user/user.permissions.js
index 896c93678749..4b6d4c957dec 100644
--- a/core/modules/user/user.permissions.js
+++ b/core/modules/user/user.permissions.js
@@ -1,5 +1,7 @@
 (function ($) {
 
+"use strict";
+
 /**
  * Shows checked and disabled checkboxes for inherited permissions.
  */
diff --git a/core/themes/bartik/color/preview.js b/core/themes/bartik/color/preview.js
index aeb417177375..531deecfe1cc 100644
--- a/core/themes/bartik/color/preview.js
+++ b/core/themes/bartik/color/preview.js
@@ -2,8 +2,10 @@
  * @file
  * Preview for the Bartik theme.
  */
-
 (function ($) {
+
+  "use strict";
+
   Drupal.color = {
     logoChanged: false,
     callback: function(context, settings, form, farb, height, width) {
-- 
GitLab