From cb3d137b2578ef87281b589a7190b42277253bd1 Mon Sep 17 00:00:00 2001 From: Gabe Dominguez Date: Wed, 30 Dec 2020 11:00:50 -0800 Subject: [PATCH] Escapes [ and ] characters in selector Fixes issue where having an id with brackets will cause jQuery to not be able to correctly find element. --- src/js/tempusdominus-bootstrap-4.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/tempusdominus-bootstrap-4.js b/src/js/tempusdominus-bootstrap-4.js index 641168c..3339ae3 100644 --- a/src/js/tempusdominus-bootstrap-4.js +++ b/src/js/tempusdominus-bootstrap-4.js @@ -15,6 +15,7 @@ const TempusDominusBootstrap4 = ($ => { // eslint-disable-line no-unused-vars selector = $element.attr('href') || ''; selector = /^#[a-z]/i.test(selector) ? selector : null; } + selector = selector.replace("[", "\\[").replace("]", "\\]"); $selector = $(selector); if ($selector.length === 0) { return $element;