Skip to content
Snippets Groups Projects
Unverified Commit 707121c9 authored by Ben Mullins's avatar Ben Mullins Committed by Lee Rowlands
Browse files

Issue #3239509 by hooroomoo, larowlan, bnjmnm, lauriii: Add String.includes...

Issue #3239509 by hooroomoo, larowlan, bnjmnm, lauriii: Add String.includes polyfill to support IE11 and Opera Mini

(cherry picked from commit 0949c10c)
parent c4debe70
No related branches found
No related tags found
29 merge requests!2496Issue #3222757 by lauriii, Wim Leers, nod_, rachel_norfolk, itmaybejj,...,!2366Issue #3285105 by Daniel Arend,!2304Issue #3258987: Class "Drupal\Core\Utility\Error" not found in _drupal_error_handler_real() due to bug in PHP 8.1.0-8.1.5,!2148Issue #3270899: Remove Color module from core,!2136Issue #3227824: Move the linkset functionality from the decoupled menus contributed module to core's system module,!2071Issue #927570: Setting 403 or 404 handler to a page that redirects leads to endless loop,!1975Issue #3269749: losing query params from user to user/login redirect,!1959Issue #3236497: Allow other modules to opt out of security release message from update_page_top,!1481Issue #3252562: Allow functions that accept no arguments to be used as callable,!1443Issue #3075230: Provide menu link with disable option [Node Add Form],!1387Draft: Resolve #2511878 "Support enclosure field",!1386Issue #3112548: Layout Builder FuncionalJavascript tests should not rely on Classy,!1377Issue #3204015: Replace Toolbar BackboneJS usage with VanillaJS equivalent,!1356Issue #3076171: Provide a new library to replace jQuery UI autocomplete,!1321Issue #3239123: Refactor (if feasible) uses of the jQuery text function to use vanillaJS,!1311Adding the checkbock suggested by the UX team,!1294Issue #3204011: Replace Tour BackboneJS usage with VanillaJS equivalent (10.0.x),!1282Issue #3227824: Add the decoupled menus module to core,!1269Issue #3239134: Refactor (if feasible) uses of the jQuery val function to use VanillaJS,!1262Issue #3239500: Add Array.includes polyfill to support IE11 and Opera Mini,!1229Issue #3225621: Use media query event listener instead of a listener on the resize event,!1159Convert dblog entries into entities,!1051Issue #3131348: Replace assertions involving calls to empty() with assertEmpty()/assertNotEmpty()/assertArrayNotHasKey(),!799Issue #3214332: Preview content is broken in Claro.,!776Resolve #85494 "Use email verification 9.3.x",!558Resolve #3020422 "Toolbar style update",!512Issue #3207771: Menu UI node type form documentation points to non-existent function,!231Issue #2671162: summary text wysiwyg patch working fine on 9.2.0-dev,!49Twig debug output does not display all suggestions when an array of theme hooks is passed to #theme
......@@ -381,6 +381,11 @@ drupal.states:
- core/once
- core/jquery.once.bc
drupal.string.includes:
version: VERSION
js:
misc/polyfills/string.includes.js: { weight: -20 }
drupal.tabbingmanager:
version: VERSION
js:
......
/**
* @file
* Provides a polyfill for String.includes().
*
* This is needed for Internet Explorer 11 and Opera Mini.
*
* This has been copied from MDN Web Docs code samples. Code samples in the MDN
* Web Docs are licensed under CC0.
*
* @see https://web.archive.org/web/20210916035058/https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
* @see https://developer.mozilla.org/en-US/docs/MDN/About#Code_samples_and_snippets
*/
/* eslint-disable strict, lines-around-directive, no-extend-native */
if (!String.prototype.includes) {
String.prototype.includes = function (search, start) {
'use strict';
if (search instanceof RegExp) {
throw TypeError('first argument must not be a RegExp');
}
if (start === undefined) {
start = 0;
}
return this.indexOf(search, start) !== -1;
};
}
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
if (!String.prototype.includes) {
String.prototype.includes = function (search, start) {
'use strict';
if (search instanceof RegExp) {
throw TypeError('first argument must not be a RegExp');
}
if (start === undefined) {
start = 0;
}
return this.indexOf(search, start) !== -1;
};
}
\ No newline at end of file
......@@ -21,5 +21,6 @@ drupal.block.admin:
- core/drupal.announce
- core/drupal.debounce
- core/drupal.dialog.ajax
- core/drupal.string.includes
- core/once
- core/jquery.once.bc
......@@ -46,7 +46,7 @@
function toggleBlockEntry(index, label) {
const $label = $(label);
const $row = $label.parent().parent();
const textMatch = $label.text().toLowerCase().indexOf(query) !== -1;
const textMatch = $label.text().toLowerCase().includes(query);
$row.toggle(textMatch);
}
......
......@@ -18,7 +18,7 @@
function toggleBlockEntry(index, label) {
var $label = $(label);
var $row = $label.parent().parent();
var textMatch = $label.text().toLowerCase().indexOf(query) !== -1;
var textMatch = $label.text().toLowerCase().includes(query);
$row.toggle(textMatch);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment