Skip to content
Snippets Groups Projects
Commit cc515842 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #715528 by sun: optimize restripe() AJAX command.

parent fe26a907
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -423,12 +423,11 @@ Drupal.ajax.prototype.commands = { ...@@ -423,12 +423,11 @@ Drupal.ajax.prototype.commands = {
restripe: function (ajax, response, status) { restripe: function (ajax, response, status) {
// :even and :odd are reversed because jQuery counts from 0 and // :even and :odd are reversed because jQuery counts from 0 and
// we count from 1, so we're out of sync. // we count from 1, so we're out of sync.
$('tbody tr:not(:hidden)', $(response.selector)) // Match immediate children of the parent element to allow nesting.
.removeClass('even').removeClass('odd') $('> tbody > tr:visible, > tr:visible', $(response.selector))
.filter(':even') .removeClass('odd even')
.addClass('odd').end() .filter(':even').addClass('odd').end()
.filter(':odd') .filter(':odd').addClass('even');
.addClass('even');
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment