--- /home/theodore/Téléchargements/1419968-28-core-js-select-with-find.patch
+++ /home/theodore/dev/DRUPAL/PATCHS/core-js-select-with-find-1419968-30.patch
@@ -912,7 +912,7 @@
        }
        if (tab_focus.length) {
 diff --git a/core/modules/block/block.js b/core/modules/block/block.js
-index 72b5673..6ebd14f 100644
+index 72b5673..7dd3c9b 100644
 --- a/core/modules/block/block.js
 +++ b/core/modules/block/block.js
 @@ -12,8 +12,9 @@ Drupal.behaviors.blockSettingsSummary = {
@@ -978,7 +978,7 @@
 +      var regionField = $rowElement.find('select.block-region-select');
        // Check whether the newly picked region is available for this block.
 -      if ($('option[value=' + regionName + ']', regionField).length == 0) {
-+      if ($(regionField).find('option[value=' + regionName + ']').length == 0) {
++      if (regionField.find('option[value=' + regionName + ']').length == 0) {
          // If not, alert the user and keep the block in its old region setting.
          alert(Drupal.t('The block cannot be placed in this region.'));
          // Simulate that there was a selected element change, so the row is put
@@ -1024,7 +1024,7 @@
  
      var checkEmptyRegions = function (table, rowObject) {
 -      $('tr.region-message', table).each(function () {
-+      $(table).find('tr.region-message').each(function () {
++      table.find('tr.region-message').each(function () {
 +        var $this = $(this);
          // If the dragged row is in this region, but above the message row, swap it down one space.
 -        if ($(this).prev('tr').get(0) == rowObject.element) {
@@ -1268,7 +1268,7 @@
        var $summaries = $widget.find('div.text-summary-wrapper');
  
 diff --git a/core/modules/field_ui/field_ui.js b/core/modules/field_ui/field_ui.js
-index 7359595..72a563c 100644
+index 7359595..d6b8a05 100644
 --- a/core/modules/field_ui/field_ui.js
 +++ b/core/modules/field_ui/field_ui.js
 @@ -7,7 +7,7 @@
@@ -1280,35 +1280,68 @@
        Drupal.fieldUIFieldOverview.attachUpdateSelects(this, settings);
      });
    }
-@@ -22,13 +22,13 @@ Drupal.fieldUIFieldOverview = {
+@@ -20,17 +20,19 @@ Drupal.fieldUIFieldOverview = {
+   attachUpdateSelects: function(table, settings) {
+     var widgetTypes = settings.fieldWidgetTypes;
      var fields = settings.fields;
++    var $table = $(table);
  
      // Store the default text of widget selects.
 -    $('.widget-type-select', table).each(function () {
-+    $(table).find('.widget-type-select').each(function () {
++    $table.find('.widget-type-select').each(function () {
        this.initialValue = this.options[0].text;
      });
  
      // 'Field type' select updates its 'Widget' select.
 -    $('.field-type-select', table).each(function () {
 -      this.targetSelect = $('.widget-type-select', $(this).closest('tr'));
-+    $(table).find('.field-type-select').each(function () {
-+      this.targetSelect = $(this).closest('tr').find('.widget-type-select');
- 
-       $(this).bind('change keyup', function () {
++    $table.find('.field-type-select').each(function () {
++      var $this = $(this);
++      this.targetSelect = $this.closest('tr').find('.widget-type-select');
+ 
+-      $(this).bind('change keyup', function () {
++      $this.bind('change keyup', function () {
          var selectedFieldType = this.options[this.selectedIndex].value;
-@@ -43,8 +43,8 @@ Drupal.fieldUIFieldOverview = {
+         var options = (selectedFieldType in widgetTypes ? widgetTypes[selectedFieldType] : []);
+         this.targetSelect.fieldUIPopulateOptions(options);
+@@ -38,20 +40,22 @@ Drupal.fieldUIFieldOverview = {
+ 
+       // Trigger change on initial pageload to get the right widget options
+       // when field type comes pre-selected (on failed validation).
+-      $(this).trigger('change', false);
++      $this.trigger('change', false);
+     });
  
      // 'Existing field' select updates its 'Widget' select and 'Label' textfield.
-     $('.field-select', table).each(function () {
+-    $('.field-select', table).each(function () {
 -      this.targetSelect = $('.widget-type-select', $(this).closest('tr'));
 -      this.targetTextfield = $('.label-textfield', $(this).closest('tr'));
-+      this.targetSelect = $(this).closest('tr').find('.widget-type-select');
-+      this.targetTextfield = $(this).closest('tr').find('.label-textfield');
++    $table.find('.field-select').each(function () {
++      var $this = $(this);
++      var $tr = $this.closest('tr');
++      this.targetSelect = $tr.find('.widget-type-select');
++      this.targetTextfield = $tr.find('.label-textfield');
        this.targetTextfield
          .data('field_ui_edited', false)
          .bind('keyup', function (e) {
-@@ -103,7 +103,7 @@ jQuery.fn.fieldUIPopulateOptions = function (options, selected) {
+           $(this).data('field_ui_edited', $(this).val() != '');
+         });
+ 
+-      $(this).bind('change keyup', function (e, updateText) {
++      $this.bind('change keyup', function (e, updateText) {
+         var updateText = (typeof updateText == 'undefined' ? true : updateText);
+         var selectedField = this.options[this.selectedIndex].value;
+         var selectedFieldType = (selectedField in fields ? fields[selectedField].type : null);
+@@ -68,7 +72,7 @@ Drupal.fieldUIFieldOverview = {
+ 
+       // Trigger change on initial pageload to get the right widget options
+       // and label when field type comes pre-selected (on failed validation).
+-      $(this).trigger('change', false);
++      $this.trigger('change', false);
+     });
+   }
+ };
+@@ -103,7 +107,7 @@ jQuery.fn.fieldUIPopulateOptions = function (options, selected) {
  
  Drupal.behaviors.fieldUIDisplayOverview = {
    attach: function (context, settings) {
@@ -1317,16 +1350,85 @@
        Drupal.fieldUIOverview.attach(this, settings.fieldUIRowsData, Drupal.fieldUIDisplayOverview);
      });
    }
-@@ -150,7 +150,7 @@ Drupal.fieldUIOverview = {
+@@ -121,7 +125,7 @@ Drupal.fieldUIOverview = {
+     tableDrag.row.prototype.onSwap = this.onSwap;
+ 
+     // Create row handlers.
+-    $('tr.draggable', table).each(function () {
++    $(table).find('tr.draggable').each(function () {
+       // Extract server-side data for the row.
+       var row = this;
+       if (row.id in rowsData) {
+@@ -140,8 +144,8 @@ Drupal.fieldUIOverview = {
+    */
+   onChange: function () {
+     var $trigger = $(this);
+-    var row = $trigger.closest('tr').get(0);
+-    var rowHandler = $(row).data('fieldUIRowHandler');
++    var $row = $trigger.closest('tr');
++    var rowHandler = $row.data('fieldUIRowHandler');
+ 
+     var refreshRows = {};
+     refreshRows[rowHandler.name] = $trigger.get(0);
+@@ -150,7 +154,7 @@ Drupal.fieldUIOverview = {
      var region = rowHandler.getRegion();
      if (region != rowHandler.region) {
        // Remove parenting.
 -      $('select.field-parent', row).val('');
-+      $(row).find('select.field-parent').val('');
++      $row.find('select.field-parent').val('');
        // Let the row handler deal with the region change.
        $.extend(refreshRows, rowHandler.regionChange(region));
        // Update the row region.
-@@ -278,7 +278,7 @@ Drupal.fieldUIDisplayOverview.field = function (row, data) {
+@@ -167,14 +171,15 @@ Drupal.fieldUIOverview = {
+   onDrop: function () {
+     var dragObject = this;
+     var row = dragObject.rowObject.element;
+-    var rowHandler = $(row).data('fieldUIRowHandler');
++    var $row = $(row);
++    var rowHandler = $row.data('fieldUIRowHandler');
+     if (rowHandler !== undefined) {
+-      var regionRow = $(row).prevAll('tr.region-message').get(0);
++      var regionRow = $row.prevAll('tr.region-message').get(0);
+       var region = regionRow.className.replace(/([^ ]+[ ]+)*region-([^ ]+)-message([ ]+[^ ]+)*/, '$2');
+ 
+       if (region != rowHandler.region) {
+         // Let the row handler deal with the region change.
+-        refreshRows = rowHandler.regionChange(region);
++        var refreshRows = rowHandler.regionChange(region);
+         // Update the row region.
+         rowHandler.region = region;
+         // Ajax-update the rows.
+@@ -195,22 +200,23 @@ Drupal.fieldUIOverview = {
+    */
+   onSwap: function (draggedRow) {
+     var rowObject = this;
+-    $('tr.region-message', rowObject.table).each(function () {
++    $(rowObject.table).find('tr.region-message').each(function () {
++      var $this = $(this);
+       // If the dragged row is in this region, but above the message row, swap
+       // it down one space.
+-      if ($(this).prev('tr').get(0) == rowObject.group[rowObject.group.length - 1]) {
++      if ($this.prev('tr').get(0) == rowObject.group[rowObject.group.length - 1]) {
+         // Prevent a recursion problem when using the keyboard to move rows up.
+         if ((rowObject.method != 'keyboard' || rowObject.direction == 'down')) {
+           rowObject.swap('after', this);
+         }
+       }
+       // This region has become empty.
+-      if ($(this).next('tr').is(':not(.draggable)') || $(this).next('tr').length == 0) {
+-        $(this).removeClass('region-populated').addClass('region-empty');
++      if ($this.next('tr').is(':not(.draggable)') || $this.next('tr').length == 0) {
++        $this.removeClass('region-populated').addClass('region-empty');
+       }
+       // This region has become populated.
+-      else if ($(this).is('.region-empty')) {
+-        $(this).removeClass('region-empty').addClass('region-populated');
++      else if ($this.is('.region-empty')) {
++        $this.removeClass('region-empty').addClass('region-populated');
+       }
+     });
+   },
+@@ -278,7 +284,7 @@ Drupal.fieldUIDisplayOverview.field = function (row, data) {
    this.tableDrag = data.tableDrag;
  
    // Attach change listener to the 'formatter type' select.
@@ -1441,10 +1543,10 @@
      values.push(Drupal.checkPlain($.trim($(this).val())));
    });
 diff --git a/core/modules/menu/menu.js b/core/modules/menu/menu.js
-index ff4ef1e..ba4b590 100644
+index ff4ef1e..f315e7a 100644
 --- a/core/modules/menu/menu.js
 +++ b/core/modules/menu/menu.js
-@@ -2,9 +2,9 @@
+@@ -2,9 +2,10 @@
  
  Drupal.behaviors.menuFieldsetSummaries = {
    attach: function (context) {
@@ -1452,12 +1554,13 @@
 -      if ($('.form-item-menu-enabled input', context).is(':checked')) {
 -        return Drupal.checkPlain($('.form-item-menu-link-title input', context).val());
 +    $(context).find('fieldset.menu-link-form').drupalSetSummary(function (context) {
-+      if ($(context).find('.form-item-menu-enabled input').is(':checked')) {
-+        return Drupal.checkPlain($(context).find('.form-item-menu-link-title input').val());
++      var $context = $(context);
++      if ($context.find('.form-item-menu-enabled input').is(':checked')) {
++        return Drupal.checkPlain($context.find('.form-item-menu-link-title input').val());
        }
        else {
          return Drupal.t('Not in menu');
-@@ -18,12 +18,14 @@ Drupal.behaviors.menuFieldsetSummaries = {
+@@ -18,12 +19,14 @@ Drupal.behaviors.menuFieldsetSummaries = {
   */
  Drupal.behaviors.menuLinkAutomaticTitle = {
    attach: function (context) {
@@ -1843,7 +1946,7 @@
            if ($(this).attr('checked')) {
              $checkbox.attr('checked', true);
 diff --git a/core/modules/user/user.permissions.js b/core/modules/user/user.permissions.js
-index 988820e..baaaa22 100644
+index 988820e..896c936 100644
 --- a/core/modules/user/user.permissions.js
 +++ b/core/modules/user/user.permissions.js
 @@ -30,12 +30,12 @@ Drupal.behaviors.permissions = {
@@ -1851,13 +1954,13 @@
          .hide();
  
 -      $('input[type=checkbox]', this).not('.rid-2, .rid-1').addClass('real-checkbox').each(function () {
-+      $(this).find('input[type=checkbox]').not('.rid-2, .rid-1').addClass('real-checkbox').each(function () {
++      $table.find('input[type=checkbox]').not('.rid-2, .rid-1').addClass('real-checkbox').each(function () {
          $dummy.clone().insertAfter(this);
        });
  
        // Initialize the authenticated user checkbox.
 -      $('input[type=checkbox].rid-2', this)
-+      $(this).find('input[type=checkbox].rid-2')
++      $table.find('input[type=checkbox].rid-2')
          .bind('click.permissions', self.toggle)
          // .triggerHandler() cannot be used here, as it only affects the first
          // element.
