Part of the JavaScript selectors clean-up effort.
#1574470: Selectors clean-up
#1415788: Javascript winter clean-up

CommentFileSizeAuthor
#19 interdiff-16-18.txt1.97 KBManuel Garcia
#18 selectors_clean_up-1751388-18.patch3.54 KBManuel Garcia
#16 drupal-fliter-module-up_1751388_13.patch3.63 KBaadrian
#13 drupal-fliter-module-up_1751388_13.patch3.87 KBrteijeiro
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch drupal-fliter-module-up_1751388_13.patch. Unable to apply patch. See the log in the details link for more information. View
#11 drupal-clean_up_node_module-1751388-11.patch10.07 KBrteijeiro
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Setup environment: Test cancelled by admin prior to completion. View
#7 interdiff-1751388-5-7.txt2.21 KBInternetDevels
#7 drupal-clean_up_node_module-1751406-7.patch9.36 KBInternetDevels
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch drupal-clean_up_node_module-1751406-7_0.patch. Unable to apply patch. See the log in the details link for more information. View
#5 drupal-fliter-module-up_1751388_5.patch3.36 KBInternetDevels
PASSED: [[SimpleTest]]: [MySQL] 63,179 pass(es). View
#2 core-js-1751388-2.patch3.13 KBJelle_S
PASSED: [[SimpleTest]]: [MySQL] 40,750 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

nod_’s picture

use .on/.off

filter.js
Untangle this crazy chained selector.

filter.admin.js
don't need context to select ID.
remove the sizzle-specific things can be done with regular js or a .prop/.attr
don't triggerhandler, only calls 1 event if more are bound to it it won't work.

Jelle_S’s picture

Status: Active » Needs review
FileSize
3.13 KB
PASSED: [[SimpleTest]]: [MySQL] 40,750 pass(es). View

Let's see...

nod_’s picture

Issue tags: +Needs JS testing

tag

seutje’s picture

Status: Needs review » Needs work
+++ b/core/modules/filter/filter.jsundefined
@@ -7,15 +7,16 @@
+    var $header = $guidelines.once('filter-guidelines').find(':header').hide();

would be nice if we could also get rid of that :header sizzle-specific selector. You can just straight replace it with h1, h2, h3, h4, h5, h6 afaik.

InternetDevels’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
3.36 KB
PASSED: [[SimpleTest]]: [MySQL] 63,179 pass(es). View
nod_’s picture

Status: Needs review » Needs work

Thanks for the patch!

For the variable declaration, it is currently up to the standards so there is no need to replace them (we have several var declaration, one variable per line).

See #1778828: [policy, no patch] Update JS coding standards for latest standards (and if you can help out the issue that'd be great!).

Can you also replace .once('filter-status', function () { with .once('filter-status').each(function () { I want to simplify the .once() function down the line and remove the second parameter #2180921: [META] Use data attributes rather than classes wherever possible.

InternetDevels’s picture

Status: Needs work » Needs review
FileSize
9.36 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch drupal-clean_up_node_module-1751406-7_0.patch. Unable to apply patch. See the log in the details link for more information. View
2.21 KB

Status: Needs review » Needs work

The last submitted patch, 7: drupal-clean_up_node_module-1751406-7.patch, failed testing.

Manuel Garcia’s picture

Parent issue: » #1574470: Selectors clean-up
rteijeiro’s picture

Status: Needs work » Needs review
FileSize
10.07 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Setup environment: Test cancelled by admin prior to completion. View

Re-rolled!

Status: Needs review » Needs work

The last submitted patch, 11: drupal-clean_up_node_module-1751388-11.patch, failed testing.

rteijeiro’s picture

Status: Needs work » Needs review
FileSize
3.87 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch drupal-fliter-module-up_1751388_13.patch. Unable to apply patch. See the log in the details link for more information. View

Ouch! Wrong patch :(

Status: Needs review » Needs work

The last submitted patch, 13: drupal-fliter-module-up_1751388_13.patch, failed testing.

aadrian’s picture

Status: Needs work » Needs review
FileSize
3.63 KB

patch file

droplet’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/filter/filter.admin.js
    @@ -3,7 +3,7 @@
    +(function ($, Drupal, drupalSettings) {
    

    Please also check if we used Drupal & drupalSettings in this file

  2. +++ b/core/modules/filter/filter.admin.js
    @@ -21,15 +21,15 @@
    -        var $row = $context.find('#' + $checkbox.attr('id').replace(/-status$/, '-weight')).closest('tr');
    +            $row = $context.find('#' + $checkbox.attr('id').replace(/-status$/, '-weight')).closest('tr'),
    ...
    -        var $filterSettings = $context.find('#' + $checkbox.attr('id').replace(/-status$/, '-settings'));
    -        var filterSettingsTab = $filterSettings.data('verticalTab');
    +            $filterSettings = $context.find('#' + $checkbox.attr('id').replace(/-status$/, '-settings')),
    +            filterSettingsTab = $filterSettings.data('verticalTab');
    
    +++ b/core/modules/filter/filter.js
    @@ -16,18 +16,18 @@
    -        var $this = $(event.target);
    -        var value = $this.val();
    +        var $this = $(event.target),
    +            value = $this.val();
    

    we don't combine var declaration

  3. +++ b/core/modules/filter/filter.js
    @@ -16,18 +16,18 @@
    +      $('.filter-guidelines').once('filterGuidelines')
    

    missing $(context)

Manuel Garcia’s picture

Status: Needs work » Needs review
FileSize
3.54 KB

Addressing comment #17.2 and #17.3

We are calling Drupal.tableDrag and not using drupalSettings on filter.admin.js.

Manuel Garcia’s picture

FileSize
1.97 KB

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.