From 2d209ae1c74e5cfce685409c703b33c47520a71c Mon Sep 17 00:00:00 2001 From: npt-1707 Date: Mon, 11 May 2026 06:50:39 +0700 Subject: [PATCH] src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js: Fix XSS --- .../libs/bootstrap_3.1.1/js/bootstrap.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js index 8ae571b6..9f198ffc 100644 --- a/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js +++ b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js @@ -84,7 +84,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } - var $parent = $(selector) + var $parent = $(document).find(selector) if (e) e.preventDefault() @@ -434,8 +434,15 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re // ================= $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { - var $this = $(this), href - var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 + var $this = $(this) + var href = $this.attr('href') + if (href) { + href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 + } + + var target = $this.attr('data-target') || href + var $target = $(document).find(target) + var options = $.extend({}, $target.data(), $this.data()) var slideIndex = $this.attr('data-slide-to') if (slideIndex) options.interval = false @@ -733,7 +740,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } - var $parent = selector && $(selector) + var $parent = selector && $(document).find(selector) return $parent && $parent.length ? $parent : $this.parent() } @@ -1003,7 +1010,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) var href = $this.attr('href') - var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 + var target = $this.attr('data-target') || + (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 + + var $target = $(document).find(target) var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) if ($this.is('a')) e.preventDefault()