diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:22:06 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:22:19 +0000 |
commit | 6c0806874f6757db30937bf5620ef41819c1538d (patch) | |
tree | 40874ca50d55d0ef5a942d26e5a37cf1516c378a /js | |
parent | Releasing debian version 5.3.1+dfsg-1. (diff) | |
download | bootstrap-html-6c0806874f6757db30937bf5620ef41819c1538d.tar.xz bootstrap-html-6c0806874f6757db30937bf5620ef41819c1538d.zip |
Merging upstream version 5.3.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js')
-rw-r--r-- | js/src/base-component.js | 2 | ||||
-rw-r--r-- | js/src/dom/selector-engine.js | 2 | ||||
-rw-r--r-- | js/src/modal.js | 4 | ||||
-rw-r--r-- | js/src/scrollspy.js | 4 | ||||
-rw-r--r-- | js/src/tab.js | 2 | ||||
-rw-r--r-- | js/src/tooltip.js | 4 | ||||
-rw-r--r-- | js/src/util/backdrop.js | 4 | ||||
-rw-r--r-- | js/src/util/sanitizer.js | 3 | ||||
-rw-r--r-- | js/tests/unit/carousel.spec.js | 4 | ||||
-rw-r--r-- | js/tests/unit/dom/selector-engine.spec.js | 24 | ||||
-rw-r--r-- | js/tests/unit/dropdown.spec.js | 4 | ||||
-rw-r--r-- | js/tests/unit/modal.spec.js | 33 | ||||
-rw-r--r-- | js/tests/unit/offcanvas.spec.js | 4 | ||||
-rw-r--r-- | js/tests/unit/scrollspy.spec.js | 4 | ||||
-rw-r--r-- | js/tests/unit/tab.spec.js | 4 | ||||
-rw-r--r-- | js/tests/unit/toast.spec.js | 4 | ||||
-rw-r--r-- | js/tests/unit/tooltip.spec.js | 4 | ||||
-rw-r--r-- | js/tests/visual/modal.html | 34 |
18 files changed, 114 insertions, 30 deletions
diff --git a/js/src/base-component.js b/js/src/base-component.js index 19a09ad..82bf770 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -14,7 +14,7 @@ import { executeAfterTransition, getElement } from './util/index.js' * Constants */ -const VERSION = '5.3.1' +const VERSION = '5.3.3' /** * Class definition diff --git a/js/src/dom/selector-engine.js b/js/src/dom/selector-engine.js index 3cecf6f..a4d81f3 100644 --- a/js/src/dom/selector-engine.js +++ b/js/src/dom/selector-engine.js @@ -29,7 +29,7 @@ const getSelector = element => { selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null } - return parseSelector(selector) + return selector ? selector.split(',').map(sel => parseSelector(sel)).join(',') : null } const SelectorEngine = { diff --git a/js/src/modal.js b/js/src/modal.js index b44cbb9..dd61649 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -11,7 +11,9 @@ import SelectorEngine from './dom/selector-engine.js' import Backdrop from './util/backdrop.js' import { enableDismissTrigger } from './util/component-functions.js' import FocusTrap from './util/focustrap.js' -import { defineJQueryPlugin, isRTL, isVisible, reflow } from './util/index.js' +import { + defineJQueryPlugin, isRTL, isVisible, reflow +} from './util/index.js' import ScrollBarHelper from './util/scrollbar.js' /** diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 69de715..368092d 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -8,7 +8,9 @@ import BaseComponent from './base-component.js' import EventHandler from './dom/event-handler.js' import SelectorEngine from './dom/selector-engine.js' -import { defineJQueryPlugin, getElement, isDisabled, isVisible } from './util/index.js' +import { + defineJQueryPlugin, getElement, isDisabled, isVisible +} from './util/index.js' /** * Constants diff --git a/js/src/tab.js b/js/src/tab.js index 5598e15..dfaef0f 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -40,7 +40,7 @@ const CLASS_DROPDOWN = 'dropdown' const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle' const SELECTOR_DROPDOWN_MENU = '.dropdown-menu' -const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)' +const NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})` const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]' const SELECTOR_OUTER = '.nav-item, .list-group-item' diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 1252811..bcdc18f 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -9,7 +9,9 @@ import * as Popper from '@popperjs/core' import BaseComponent from './base-component.js' import EventHandler from './dom/event-handler.js' import Manipulator from './dom/manipulator.js' -import { defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index.js' +import { + defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop +} from './util/index.js' import { DefaultAllowlist } from './util/sanitizer.js' import TemplateFactory from './util/template-factory.js' diff --git a/js/src/util/backdrop.js b/js/src/util/backdrop.js index 0d478e9..82b5490 100644 --- a/js/src/util/backdrop.js +++ b/js/src/util/backdrop.js @@ -7,7 +7,9 @@ import EventHandler from '../dom/event-handler.js' import Config from './config.js' -import { execute, executeAfterTransition, getElement, reflow } from './index.js' +import { + execute, executeAfterTransition, getElement, reflow +} from './index.js' /** * Constants diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js index d2b0808..3d2883a 100644 --- a/js/src/util/sanitizer.js +++ b/js/src/util/sanitizer.js @@ -17,7 +17,10 @@ export const DefaultAllowlist = { br: [], col: [], code: [], + dd: [], div: [], + dl: [], + dt: [], em: [], hr: [], h1: [], diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js index c468b5c..2960eb5 100644 --- a/js/tests/unit/carousel.spec.js +++ b/js/tests/unit/carousel.spec.js @@ -2,7 +2,9 @@ import Carousel from '../../src/carousel.js' import EventHandler from '../../src/dom/event-handler.js' import { isRTL, noop } from '../../src/util/index.js' import Swipe from '../../src/util/swipe.js' -import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js' +import { + clearFixture, createEvent, getFixture, jQueryMock +} from '../helpers/fixture.js' describe('Carousel', () => { const { Simulator, PointerEvent } = window diff --git a/js/tests/unit/dom/selector-engine.spec.js b/js/tests/unit/dom/selector-engine.spec.js index 8dd7b1f..95d9bf8 100644 --- a/js/tests/unit/dom/selector-engine.spec.js +++ b/js/tests/unit/dom/selector-engine.spec.js @@ -359,6 +359,30 @@ describe('SelectorEngine', () => { expect(SelectorEngine.getMultipleElementsFromSelector(testEl)).toEqual(Array.from(fixtureEl.querySelectorAll('.target'))) }) + it('should get elements if several ids are given', () => { + fixtureEl.innerHTML = [ + '<div id="test" data-bs-target="#target1,#target2"></div>', + '<div class="target" id="target1"></div>', + '<div class="target" id="target2"></div>' + ].join('') + + const testEl = fixtureEl.querySelector('#test') + + expect(SelectorEngine.getMultipleElementsFromSelector(testEl)).toEqual(Array.from(fixtureEl.querySelectorAll('.target'))) + }) + + it('should get elements if several ids with special chars are given', () => { + fixtureEl.innerHTML = [ + '<div id="test" data-bs-target="#j_id11:exampleModal,#j_id22:exampleModal"></div>', + '<div class="target" id="j_id11:exampleModal"></div>', + '<div class="target" id="j_id22:exampleModal"></div>' + ].join('') + + const testEl = fixtureEl.querySelector('#test') + + expect(SelectorEngine.getMultipleElementsFromSelector(testEl)).toEqual(Array.from(fixtureEl.querySelectorAll('.target'))) + }) + it('should get elements in array, from href if no data-bs-target set', () => { fixtureEl.innerHTML = [ '<a id="test" href=".target"></a>', diff --git a/js/tests/unit/dropdown.spec.js b/js/tests/unit/dropdown.spec.js index 8447be6..1560055 100644 --- a/js/tests/unit/dropdown.spec.js +++ b/js/tests/unit/dropdown.spec.js @@ -1,7 +1,9 @@ import EventHandler from '../../src/dom/event-handler.js' import Dropdown from '../../src/dropdown.js' import { noop } from '../../src/util/index.js' -import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js' +import { + clearFixture, createEvent, getFixture, jQueryMock +} from '../helpers/fixture.js' describe('Dropdown', () => { let fixtureEl diff --git a/js/tests/unit/modal.spec.js b/js/tests/unit/modal.spec.js index 6434d8b..2aa0b76 100644 --- a/js/tests/unit/modal.spec.js +++ b/js/tests/unit/modal.spec.js @@ -1,7 +1,9 @@ import EventHandler from '../../src/dom/event-handler.js' import Modal from '../../src/modal.js' import ScrollBarHelper from '../../src/util/scrollbar.js' -import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js' +import { + clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock +} from '../helpers/fixture.js' describe('Modal', () => { let fixtureEl @@ -989,6 +991,35 @@ describe('Modal', () => { trigger.click() }) }) + + it('should open modal, having special characters in its id', () => { + return new Promise(resolve => { + fixtureEl.innerHTML = [ + '<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#j_id22:exampleModal">', + ' Launch demo modal', + '</button>', + '<div class="modal fade" id="j_id22:exampleModal" aria-labelledby="exampleModalLabel" aria-hidden="true">', + ' <div class="modal-dialog">', + ' <div class="modal-content">', + ' <div class="modal-body">', + ' <p>modal body</p>', + ' </div>', + ' </div>', + ' </div>', + '</div>' + ].join('') + + const modalEl = fixtureEl.querySelector('.modal') + const trigger = fixtureEl.querySelector('[data-bs-toggle="modal"]') + + modalEl.addEventListener('shown.bs.modal', () => { + resolve() + }) + + trigger.click() + }) + }) + it('should not prevent default when a click occurred on data-bs-dismiss="modal" where tagName is DIFFERENT than <a> or <area>', () => { return new Promise(resolve => { fixtureEl.innerHTML = [ diff --git a/js/tests/unit/offcanvas.spec.js b/js/tests/unit/offcanvas.spec.js index 03e7d9e..3b6c98c 100644 --- a/js/tests/unit/offcanvas.spec.js +++ b/js/tests/unit/offcanvas.spec.js @@ -2,7 +2,9 @@ import EventHandler from '../../src/dom/event-handler.js' import Offcanvas from '../../src/offcanvas.js' import { isVisible } from '../../src/util/index.js' import ScrollBarHelper from '../../src/util/scrollbar.js' -import { clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js' +import { + clearBodyAndDocument, clearFixture, createEvent, getFixture, jQueryMock +} from '../helpers/fixture.js' describe('Offcanvas', () => { let fixtureEl diff --git a/js/tests/unit/scrollspy.spec.js b/js/tests/unit/scrollspy.spec.js index ecbd952..fc44471 100644 --- a/js/tests/unit/scrollspy.spec.js +++ b/js/tests/unit/scrollspy.spec.js @@ -1,6 +1,8 @@ import EventHandler from '../../src/dom/event-handler.js' import ScrollSpy from '../../src/scrollspy.js' -import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js' +import { + clearFixture, createEvent, getFixture, jQueryMock +} from '../helpers/fixture.js' describe('ScrollSpy', () => { let fixtureEl diff --git a/js/tests/unit/tab.spec.js b/js/tests/unit/tab.spec.js index 007addd..4fcf8ee 100644 --- a/js/tests/unit/tab.spec.js +++ b/js/tests/unit/tab.spec.js @@ -1,5 +1,7 @@ import Tab from '../../src/tab.js' -import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js' +import { + clearFixture, createEvent, getFixture, jQueryMock +} from '../helpers/fixture.js' describe('Tab', () => { let fixtureEl diff --git a/js/tests/unit/toast.spec.js b/js/tests/unit/toast.spec.js index cfc56c7..200fe3e 100644 --- a/js/tests/unit/toast.spec.js +++ b/js/tests/unit/toast.spec.js @@ -1,5 +1,7 @@ import Toast from '../../src/toast.js' -import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js' +import { + clearFixture, createEvent, getFixture, jQueryMock +} from '../helpers/fixture.js' describe('Toast', () => { let fixtureEl diff --git a/js/tests/unit/tooltip.spec.js b/js/tests/unit/tooltip.spec.js index 080432e..ceb8de4 100644 --- a/js/tests/unit/tooltip.spec.js +++ b/js/tests/unit/tooltip.spec.js @@ -1,7 +1,9 @@ import EventHandler from '../../src/dom/event-handler.js' import Tooltip from '../../src/tooltip.js' import { noop } from '../../src/util/index.js' -import { clearFixture, createEvent, getFixture, jQueryMock } from '../helpers/fixture.js' +import { + clearFixture, createEvent, getFixture, jQueryMock +} from '../helpers/fixture.js' describe('Tooltip', () => { let fixtureEl diff --git a/js/tests/visual/modal.html b/js/tests/visual/modal.html index 09d4233..efb5127 100644 --- a/js/tests/visual/modal.html +++ b/js/tests/visual/modal.html @@ -13,21 +13,25 @@ </style> </head> <body> - <nav class="navbar navbar-full navbar-dark bg-dark"> - <button class="navbar-toggler hidden-lg-up" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"></button> - <div class="collapse navbar-expand-md" id="navbarResponsive"> - <a class="navbar-brand" href="#">This shouldn't jump!</a> - <ul class="navbar-nav"> - <li class="nav-item"> - <a class="nav-link active" href="#" aria-current="page">Home</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="#">Link</a> - </li> - <li class="nav-item"> - <a class="nav-link" href="#">Link</a> - </li> - </ul> + <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> + <div class="container-fluid"> + <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="navbarResponsive"> + <a class="navbar-brand" href="#">This shouldn't jump!</a> + <ul class="navbar-nav"> + <li class="nav-item"> + <a class="nav-link active" href="#" aria-current="page">Home</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + </ul> + </div> </div> </nav> |