Skip to content
Snippets Groups Projects
Commit 0949c10c 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
parent 04f25785
No related branches found
No related tags found
34 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!2074Issue #2707689: NodeForm::actions() checks for delete access on new entities,!1896Issue #2940605: Can only intentionally re-render an entity with references 20 times,!1459Issue #3087632: menu_name max length is too long,!1398Issue #3186992 by hinal05, djsagar, kiran.kadam911, hitvika_verma,...,!1348New MR specifically for re-adding after code freeze,!1283Issue #2922435: "Add new comment" and "@count comments" links are not following accessibility good practices,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1254Issue #3238915: Refactor (if feasible) uses of the jQuery ready function to use VanillaJS,!1213Issue #3236497: Allow other modules to opt out of security release message from update_page_top,!1185Issue 318778: Rerolled patch.,!1162Issue #3100350: Unable to save '/' root path alias,!1158Draft: Resolve #3161889 "Symfony 5 4",!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!1018Issue #2793343: Dialog drupalAutoButtons option should be respected on initial load,!1014Issue #3226806: Move filter implementations from filter.module to plugin classes,!957Added throwing of InvalidPluginDefinitionException from getDefinition().,!939Issue #2971209: Allow the MediaLibraryUiBuilder service to use an alternative view display,!878Issue #3221534: throw an exception when IDs passed to loadMultiple() are badly formed,!877Issue #2708101: Default value for link text is not saved,!873Issue #2875228: Site install not using batch API service,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links,!866Issue #2845319: The highlighting of the 'Home' menu-link does not respect query strings and fragment identifiers,!844Resolve #3036010 "Updaters",!8293023322 - Contextual Links Style Update,!712Issue #2909128: Autocomplete intermittent on Chrome Android,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.,!449Issue #2784233: Allow multiple vocabularies in the taxonomy filter,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
......@@ -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