--- jquery_update.module.orig	2014-05-06 10:23:22.000000000 -0400
+++ jquery_update.module	2014-05-08 14:09:27.000000000 -0400
@@ -68,6 +68,15 @@ function jquery_update_library() {
     ),
     'version' => '2.1.2',
   );
+
+  // Load and configure the jQuery Migrate Plugin
+  $jquery_migrate_plugin_enabled = variable_get('jquery_update_jquery_migrate_plugin_enable', false);
+  if ($jquery_migrate_plugin_enabled) {
+    $jquery_update_path = drupal_get_path('module', 'jquery_update');
+    $min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min';
+    jquery_update_jquery_migrate_plugin_configure($libraries, $jquery_update_path, $min);
+  }
+
   return $libraries;
 }
 
@@ -78,7 +87,6 @@ function jquery_update_library_alter(&$j
   $path = drupal_get_path('module', 'jquery_update');
   $version = variable_get('jquery_update_jquery_version', '1.10');
 
-
   // Modified System Library.
   if ($module === 'system') {
 
@@ -105,6 +113,12 @@ function jquery_update_library_alter(&$j
     $javascript['drupal.ajax']['dependencies'][] = array('jquery_update', 'jquery_update.ajax.fix');
     jquery_update_jquery_replace($javascript, $cdn, $path, $min, $version);
 
+    // Add the jQuery Migrate Plugin as a dependency
+    $jquery_migrate_plugin_enabled = variable_get('jquery_update_jquery_migrate_plugin_enable', false);
+    if ($jquery_migrate_plugin_enabled) {
+      $javascript['jquery']['dependencies'][] = array('jquery_update', 'jquery.migrate');
+    }
+
     // Replace jQuery UI with CDN or local files. If from a CDN include all of
     // jQuery UI.
     if (version_compare($version, '1.6', '>=')) {
@@ -209,6 +223,43 @@ function jquery_update_settings_form() {
     '#description' => t('Use jQuery and jQuery UI from a CDN. If the CDN is not available the local version of jQuery and jQuery UI will be used.'),
   );
 
+  $form['jquery_migrate_plugin'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('jQuery Migrate Plugin'),
+  );
+
+  $form['jquery_migrate_plugin']['jquery_update_jquery_migrate_plugin_enable'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable jQuery Migrate Plugin'),
+    '#default_value' => variable_get('jquery_update_jquery_migrate_plugin_enable', false),
+    '#description' => t('Use the <a href="http://github.com/jquery/jquery-migrate/#readme">jQuery Migrate Plugin</a> for enhanced compatibility'),
+  );
+
+  $form['jquery_migrate_plugin']['jquery_update_jquery_migrate_plugin_cdn'] = array(
+    '#type' => 'select',
+    '#title' => t('jQuery Migrate Plugin CDN'),
+    '#options' => array(
+      'none' => t('None'),
+      'jquery' => t('jQuery'),
+    ),
+    '#default_value' => variable_get('jquery_update_jquery_migrate_plugin_cdn', 'none'),
+    '#description' => t('Use the jQuery Migrate Plugin from a CDN. If the CDN is not available the local version of the plugin will be used.'),
+  );
+
+  $form['jquery_migrate_plugin']['jquery_update_jquery_migrate_plugin_migrate_warnings'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable console warnings'),
+    '#default_value' => variable_get('jquery_update_jquery_migrate_plugin_migrate_warnings', true),
+    '#description' => t('Toggle the <a href="https://github.com/jquery/jquery-migrate/#migrate-plugin-api">generation of console warnings</a> when using the debug version of jQuery Migrate'),
+  );
+
+  $form['jquery_migrate_plugin']['jquery_update_jquery_migrate_plugin_migrate_trace'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable console trace'),
+    '#default_value' => variable_get('jquery_update_jquery_migrate_plugin_migrate_trace', true),
+    '#description' => t('Toggle the <a href="https://github.com/jquery/jquery-migrate/#migrate-plugin-api">generation of console trace messages</a> when using the debug version of jQuery Migrate'),
+  );
+
   return system_settings_form($form);
 }
 
@@ -313,6 +364,86 @@ function jquery_update_jquery_backup(&$j
   );
 }
 
+/**
+ * Enable and configure the jQuery Migrate Plugin
+ *
+ * @param array $javascript
+ *   The library definition array as seen in hook_library_alter().
+ * @param string $path
+ *   The path to the module where replacements can be found.
+ * @param string $min
+ *   The '.min' to include in the file name if we are requesting a minified
+ *   version.
+ */
+function jquery_update_jquery_migrate_plugin_configure(&$javascript, $path, $min) {
+  // Use a static version
+  $version = '1.2.1';
+  $local_path = $path . '/replace/jquery-migrate/' . $version . '/jquery-migrate' . $min . '.js';
+
+  // Add the plugin
+  // Note: Use a weight slightly heavier than the jQuery backup version (see 
+  // jquery_update_jquery_backup).
+  $javascript['jquery.migrate'] = array(
+    'title' => 'jQuery Migrate',
+    'website' => 'http://plugins.jquery.com/migrate',
+    'version' => $version,
+    'js' => array(
+      $local_path => array('group' => JS_LIBRARY, 'weight' => -19.8),
+    ),
+  );
+
+  // Check for CDN support.
+  $cdn = variable_get('jquery_update_jquery_migrate_plugin_cdn', 'none');
+  switch ($cdn) {
+    case 'jquery':
+      $javascript['jquery.migrate']['js'][$local_path]['data'] = '//code.jquery.com/jquery-migrate-' . $version . $min . '.js';
+      $javascript['jquery.migrate']['js'][$local_path]['type'] = 'external';
+      jquery_update_jquery_migrate_plugin_backup($javascript, $path, $min, $version);
+      break;
+
+    case 'none':
+    default:
+      $javascript['jquery.migrate']['js'][$local_path]['data'] = $local_path;
+      break;
+  }
+
+  // Configuration via the jQuery Plugin API
+  // Note: This must be just below the backup version of the plugin
+  // Note: The Drupal UI and the internal variables use the 'enabled' tense in 
+  // the name which is contrary to the jQuery.migrateMute parameter. Account 
+  // for this when assigning the values.
+  $migrate_mute = variable_get('jquery_update_jquery_migrate_plugin_migrate_warnings', true) ? 'false' : 'true';
+  $migrate_trace = variable_get('jquery_update_jquery_migrate_plugin_migrate_trace', true) ? 'true' : 'false';
+  $javascript['jquery.migrate']['js'][] = array(
+    'data' => 'jQuery.migrateMute = ' . $migrate_mute . '; jQuery.migrateTrace = ' . $migrate_trace . ';',
+    'type' => 'inline',
+    'group' => JS_LIBRARY,
+    'weight' => -19.75,
+  );
+}
+
+/**
+ * Add the local fallback in case the jQuery Migrate Plugin from the CDN is unavailable.
+ *
+ * @param array $javascript
+ *   The $libraries array as seen in hook_library_alter()
+ * @param string $path
+ *   The path to the module where replacements can be found.
+ * @param string $min
+ *   The '.min' to include in the file name if we are requesting a minified
+ *   version.
+ * @param string $version
+ *   The version of the jQuery Migrate Plugin to use.
+ */
+function jquery_update_jquery_migrate_plugin_backup(&$javascript, $path, $min, $version) {
+  $javascript['jquery.migrate']['js'][] = array(
+    'data' => 'document.write("<script src=\'' . base_path() . $path . '/replace/jquery-migrate/' . $version . '/jquery-migrate' . $min . '.js\'>\x3C/script>")',
+    'type' => 'inline',
+    'group' => JS_LIBRARY,
+    'weight' => -19.7999999999,
+  );
+}
+
 /**
  * Update jQuery UI to the CDN or local path.
  *
