0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00
Commit Graph

2360 Commits

Author SHA1 Message Date
GeoSot
699402bee5 Carousel: refactor _slide method te accept only order as first argument 2022-03-09 17:25:47 +02:00
GeoSot
fcc2c80976 Carousel: add a getItems helper 2022-03-09 17:25:47 +02:00
GeoSot
b7cce49dbc Carousel: use combined selector and drop variable used once 2022-03-09 17:25:47 +02:00
GeoSot
a8142497c7 Carousel: reorder variables and refactor method to use it inline 2022-03-09 17:25:47 +02:00
GeoSot
e77ae50311 Carousel: cleanup jQueryInterface
Drop chained else ifs and unused variable.

Since we were checking for `typeof config === 'string'` in both places, action was never `_config.slide`.
2022-03-09 17:25:47 +02:00
louismaxime.piton
6c40476af9 Fix dropdowns 2022-03-08 14:37:44 -08:00
Jann Westermann
8d7358f231
Add static backdrop to offcanvas (#35832)
* Add static backdrop option,  to offcanvas
* Trigger prevented event on esc with keyboard=false
* Change offcanvas doc , moving backdrop examples to examples section
2022-03-02 02:20:37 +02:00
GeoSot
63f30ac8ee
Modal: refactor listeners to reduce some code noise (#35902) 2022-03-01 17:08:12 +02:00
GeoSot
c644f09d88 Carousel: simplify carousel items selection
We already know that carousel's parent is the carousel element, so we can use it explicitly
2022-03-01 16:56:33 +02:00
GeoSot
eb8d5b43ce Carousel: move carouselInterface inside jqueryInterface 2022-03-01 16:56:33 +02:00
GeoSot
13042d25ca Carousel: move logic of dataApiClickHandler 2022-03-01 16:56:33 +02:00
GeoSot
631cec4f70 Carousel: refactor dataApiKeyHandler to avoid use of carouselInterface 2022-03-01 16:56:33 +02:00
GeoSot
bb7664db0a
Dropdown: Simplify dataKeyApiHandler (#35870)
* Dropdown.js: Remove duplicated check for `Not Shown` instance

* Dropdown.js: Rearrange `dataApiKeydownHandler` checks

* Dropdown: do some fixup inside `dataApiKeydownHandler`

* Update dropdown.js

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2022-03-01 15:53:07 +02:00
Mark Otto
7a74f2c302 add tests 2022-02-28 14:02:51 -08:00
Mark Otto
c0f30366ac Add centered dropdown and dropup options 2022-02-28 14:02:51 -08:00
Дилян Палаузов
e4b62a920a src/tooltip.js Optimization
Util.findShadowRoot() returns either null or an object.

It cannot return falsy, which allows this optimization.
2022-02-25 09:01:49 -08:00
GeoSot
cb8726d9e7
Dropdown: use a better selector to avoid triggering click if button is disabled (#35866) 2022-02-19 16:22:32 +02:00
GeoSot
353ad45b4b
Dropdown: use a combined selector to filter foreign not shown instances iteration (#35766) 2022-02-19 16:16:51 +02:00
GeoSot
4b17868fb4
tests: revisit all tests using Promise.reject instead of throwing an error (#35765) 2022-02-19 16:08:16 +02:00
GeoSot
407af8ac7f
Make event name helper and use it on tooltip & popover to reduce dist sizes (#35856)
* feat: create eventName getter function in baseComponent

* refactor: use `eventName` getter on tooltip & popover
2022-02-19 15:10:47 +02:00
GeoSot
642d756eea Carousel: remove one more call to ActiveIndex 2022-02-19 14:52:36 +02:00
GeoSot
d52f6c9de1 Carousel: change argument to _setActiveIndicatorElement, from element to index 2022-02-19 14:52:36 +02:00
GeoSot
928bdcadc5 Carousel: make direct triggering of slid event, instead of using a callback 2022-02-19 14:52:36 +02:00
GeoSot
d97125475b Carousel: merge slide functionality, regardless of whether it is animated or not 2022-02-19 14:52:36 +02:00
GeoSot
a247fe9b27 Carousel: simplify initialization on document load, using getOrCreateInstance 2022-02-19 14:52:36 +02:00
GeoSot
ccba6a3589 Carousel: remove redundant config merge on dataApiClickHandler, as it is done by default in the constructor 2022-02-19 14:52:36 +02:00
XhmikosR
42da2b9556
Update devDependencies (#35841)
* Update devDependencies

* @babel/core             ^7.17.0  →  ^7.17.2
* @rollup/plugin-replace   ^3.0.1  →   ^3.1.0
* eslint                   ^8.8.0  →   ^8.9.0
* eslint-config-xo        ^0.39.0  →  ^0.40.0
* hugo-bin                ^0.80.1  →  ^0.80.2
* karma                   ^6.3.15  →  ^6.3.16
* rollup                  ^2.67.1  →  ^2.67.2

* Fix new ESLint errors
2022-02-15 08:50:37 +02:00
Julien Déramond
d3babf7d7f
Remove remaining .navbar-light classes (#35814)
* Fix typo in CSS variables documentation

* Drop remaining .navbar-light classes
2022-02-09 21:12:08 +02:00
Anton
a805330f63
Optimize jQueryInterface in Collapse (#35689)
extracts config initialization from cycle
2022-02-07 10:50:26 +02:00
XhmikosR
cf7fec8a2e event-handler.js: remove unneeded return statement 2022-02-01 12:43:19 +02:00
GeoSot
a1e924c4da Event-handler: use Array.find instead of for 2022-02-01 12:43:19 +02:00
GeoSot
fc7c5fcb7a Event-handler: initialize variable properly 2022-02-01 12:43:19 +02:00
GeoSot
3f7b31e0e0
Fix Popover test that randomly fails on BrowserStack (#35757)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2022-02-01 10:33:18 +02:00
GeoSot
c44d99f55c Dropdown: use destructured variables in dataApyKeydownHandler 2022-02-01 08:58:46 +02:00
GeoSot
c14fc989df Dropdown: dropdown doesn't document data-bs-target option & parentNode is ALWAYS the wrapper for toggle & menu 2022-02-01 08:58:46 +02:00
GeoSot
d105439235 Dropdown: merge instance identification in dataApiKeydownHandler
As we use the `dataApiKeydownHandler` only for events that are triggered on `[data-bs-toggle="dropdown"]` or on `.dropdown-menu`, we can ensure that their `parentNode` will ALWAYS be the `.dropdown` wrapper
2022-02-01 08:58:46 +02:00
GeoSot
7f04f84bf8 Dropdown: use only one check for shown state 2022-01-30 18:01:09 +02:00
GeoSot
5f1c542d67 Dropdown: get dropdown's parent in one place 2022-01-30 18:01:09 +02:00
GeoSot
74f24cdf24
More tooltip refactoring (#35546)
* Tooltip.js: move `shown` check to method

* Tooltip.js: move Popper's creation to method

* Tooltip.js: merge checks before `hide`

* Tooltip.js: minor refactoring on `toggle` method
2022-01-30 17:39:03 +02:00
GeoSot
882185bbde
Change selector-engine.js parents method to utilize better js native methods (#35684)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2022-01-30 16:24:03 +02:00
XhmikosR
89f88762c5
Fix visual tests (#35585)
* Fix visual tests

They broke in #34509

* load bundle.js in visual tests

Co-authored-by: GeoSot <geo.sotis@gmail.com>
2022-01-30 16:12:24 +02:00
GeoSot
dcbe7b6f31 Modal.js: remove unnecessary checks from test 2022-01-30 15:39:34 +02:00
GeoSot
28c9002573 Modal: handle click event from backdrop callback 2022-01-30 15:39:34 +02:00
GeoSot
aa650f0f1e
tests: replace 'done' callback with 'Promise' to fix deprecation errors (#35659)
Reference:

https://jasmine.github.io/tutorials/async

'DEPRECATION: An asynchronous function called its 'done' callback more than once. This is a bug in the spec, beforeAll, beforeEach, afterAll, or afterEach function in question. This will be treated as an error in a future version. See<https://jasmine.github.io/tutorials/upgrading_to_Jasmine_4.0#deprecations-due-to-calling-done-multiple-times> for more information.
2022-01-30 14:30:04 +02:00
GeoSot
d092817059 Event handler: merge new Event with new CustomEvent 2022-01-30 14:15:17 +02:00
GeoSot
fa93995123 Event handler: replace deprecated initEvent 2022-01-30 14:15:17 +02:00
XhmikosR
0840105d7f SelectorEngine: remove moot space 2022-01-29 13:25:30 +02:00
XhmikosR
558002f3dc Return early in more places 2022-01-29 13:25:30 +02:00
XhmikosR
7d3bc44bb0 dropdown: Move constant 2022-01-29 13:25:30 +02:00
GeoSot
a8887ea8a8 collapse: merge class toggling 2022-01-29 13:25:30 +02:00
XhmikosR
b5147ec218 event-handler.js: use for...of 2022-01-29 13:25:30 +02:00
XhmikosR
62d86c07f8 Rename variables 2022-01-29 13:25:30 +02:00
XhmikosR
3ac4451d47 backdrop.js: cache _getElement calls 2022-01-29 13:25:30 +02:00
XhmikosR
0c3dfe104b Remove a few unneeded variables 2022-01-29 13:25:30 +02:00
Ryan Berliner
14c7dc1e88
Fix: isVisible function behavior in case of a <details> element, on chrome 97 (#35682) 2022-01-13 10:55:05 +02:00
Patrick H. Lauke
0d054bb0f1
Remove explicit use of aria-hidden for offcanvas when closed (#35589)
Remove explicit use of aria-hidden & visibility for offcanvas when closed, handling it with css

Co-authored-by: GeoSot <geo.sotis@gmail.com>
Co-authored-by: Gaël Poupard <ffoodd@users.noreply.github.com>
2022-01-05 19:20:15 +02:00
GeoSot
0d4213bde3 Carousel: move repeated code to a method 2021-12-21 17:37:24 +02:00
GeoSot
b8ee68cfa0 Carousel: remove always true visibilityState check
According to https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState `visibilityState` is always a string, so the check was always true
2021-12-21 17:37:24 +02:00
GeoSot
ff4bf4a458 Carousel: move carousel default interval to _getConfig() and simplify it 2021-12-21 17:37:24 +02:00
GeoSot
6f79721c82 Carousel: return early and drop a loop.
We can achieve the same thing by querying the specific selector directly
2021-12-21 17:37:24 +02:00
GeoSot
d60f146507 Carousel: add a helper to get the active element 2021-12-21 17:37:24 +02:00
GeoSot
65cf77ae3e
Popover/Tooltip: Fix vertical alignment on arrow of tip elements (#35527)
Regression of #32692

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-12-21 17:19:29 +02:00
Phil E. Taylor
c2db7108c2
Fix typo in comment (#35564)
s/moddal/modal
2021-12-18 07:58:31 +02:00
GeoSot
e0960b08e0
Tooltip: remove extraneous call to _getConfig() (#35540)
BaseClass already initializes the config

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-12-15 10:47:32 +02:00
GeoSot
d40fae456e
Popover.js: Accept empty content through data-bs-content (#35514)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-12-15 10:41:31 +02:00
XhmikosR
cd04fe015f
Scrollspy: minor refactoring (#35512)
* reorder variables
* join lines
* use `filter(Boolean)` since it's clearer
* use `for...of`
2021-12-15 09:38:06 +02:00
GeoSot
886b940796
Extract Component config functionality to a separate class (#33872)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-12-10 18:18:18 +02:00
XhmikosR
63d38b1974
Tab: minor refactoring (#35511)
* remove unneeded parentheses
* move variable
2021-12-10 07:51:57 +02:00
XhmikosR
871c8bdd3f
util/index.js: minor refactoring (#35510)
* rename variables
* remove an unused variable
* be more explicit
* reuse variable
2021-12-10 07:48:04 +02:00
XhmikosR
eaa801c899
Toast: join multiple classList calls (#35507) 2021-12-10 07:42:08 +02:00
XhmikosR
94d4fa3b10
Fix tests fixture type (#35501)
Previously we were adding an Array instead of a String
2021-12-09 16:01:29 +02:00
GeoSot
28a5a72ed5
Scrollbar - remove margin/padding properties properly (#35388)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-12-09 15:49:28 +02:00
GeoSot
c376cb0763
Dropdown: fix toggle focus after dropdown is hidden using the ESC button (#35500) 2021-12-09 15:34:17 +02:00
GeoSot
4fd5539c75
ScrollBar.js. Minor refactoring and add test (#35492) 2021-12-09 15:05:50 +02:00
GeoSot
328f723008
Tooltip: remove title attribute before show & add tests (#35456) 2021-12-07 15:51:56 +02:00
Louis-Maxime Piton
d8999dd566
Tests: Minor fixes (#35455) 2021-12-02 12:01:11 +02:00
GeoSot
385fea49e8 Tooltip/Popover: add underscore prefix to protected functions 2021-12-01 18:00:36 +02:00
GeoSot
bd79d69a73 Tooltip: a simple code-block position change 2021-12-01 18:00:36 +02:00
GeoSot
1f7b83203d Tooltip: simplify popper check 2021-12-01 18:00:36 +02:00
GeoSot
9b9372e8dd Tooltip: refactor _hoverState to Boolean to achieve better control 2021-12-01 18:00:36 +02:00
GeoSot
8eacbaa08b Tooltip: merge timeout functionality 2021-12-01 18:00:36 +02:00
GeoSot
c69ccba08c Tooltip: Change _enter & _leave to work without arguments 2021-12-01 18:00:36 +02:00
GeoSot
a20e4203fe Tooltip: Remove redundant config.delay check
`config.delay` is always an object after initialization
2021-12-01 18:00:36 +02:00
GeoSot
724663b3cd Tooltip: Remove Data.set usage for dynamically created tip
This is not used any further, so we were just setting it.
2021-12-01 18:00:36 +02:00
GeoSot
3baeb0a5c1 Tooltip: merge isAnimated checks 2021-12-01 18:00:36 +02:00
GeoSot
53c77c0203 Tooltip: refactor jQueryInterface 2021-12-01 18:00:36 +02:00
GeoSot
dd07c1ff9e Dropdown: clearMenus is always an event callback 2021-12-01 17:10:39 +02:00
GeoSot
f71640f048 Dropdown: Clean more 2021-12-01 17:10:39 +02:00
GeoSot
21e5618ba7 Dropdown: rename vars 2021-12-01 17:10:39 +02:00
GeoSot
0686fa00f0 Dropdown: Remove redundant Space check 2021-12-01 17:10:39 +02:00
GeoSot
a14a552d83 Dropdown: Deduplicate complex check 2021-12-01 17:10:39 +02:00
GeoSot
bff95d55af Dropdown: Remove redundant check since the show method already does it 2021-12-01 17:10:39 +02:00
GeoSot
2d32802f53 Dropdown: Change constant to the way we use it 2021-12-01 17:10:39 +02:00
GeoSot
fb5921dec4 Dropdown: Merge display='static' & isNavbar functionality activating static popper with no styles attached 2021-12-01 17:10:39 +02:00
GeoSot
137b324930 Dropdown: Remove static method used once 2021-12-01 17:10:39 +02:00
GeoSot
8b308b76f0
Dropdown tests: Use a function to improve readability (#35448) 2021-12-01 16:49:02 +02:00
GeoSot
cab62af2e6
Fix popover arrow & tooltip template after the setContent addition (#35441) 2021-12-01 15:10:10 +02:00
GeoSot
44a6cd724c
Tooltip: remove leftover method (#35440)
Remove a leftover after #32692

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-12-01 14:53:56 +02:00
XhmikosR
e5d8256e42 tests/unit/util/scrollbar.spec.js: rename function
`parseInt` is a global one.
2021-12-01 14:30:49 +02:00
XhmikosR
11ce6c2dcd tests: fix a few typos 2021-12-01 14:30:49 +02:00
XhmikosR
f8f9dc3b5c tests: remove extra spaces, unneeded arrays and add missing newlines 2021-12-01 14:30:49 +02:00
XhmikosR
eb54e1a1ce tests: tweak Jasmine's matchers usage
Use:

* toBeNull
* toEqual
* toBeTrue
* toBeFalse
* toHaveSize
* toHaveClass
2021-12-01 14:30:49 +02:00
XhmikosR
5739bf7637 tests/browsers.js: remove unneeded export 2021-12-01 14:30:49 +02:00
GeoSot
1692fc6b4b
Alert: add a couple more tests (#35419)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-11-29 14:32:11 +02:00
GeoSot
3129ff075b
BaseComponent: add a couple more tests (#35410)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-11-29 14:27:03 +02:00
GeoSot
6f077ff7bc
Clean tooltip component unneeded functionality (#32692) 2021-11-25 20:08:11 +02:00
GeoSot
374eeecfbc
tooltip.js: use array.includes instead of for iteration (#35127) 2021-11-25 19:39:13 +02:00
GeoSot
91ad255e07 Change adjustDialog's if conditions to improve readability 2021-11-25 19:23:49 +02:00
GeoSot
569bca54d2 Add test for modal-content 2021-11-25 19:23:49 +02:00
GeoSot
0f9fd75d6c Respect modal's initial overflowY 2021-11-25 19:23:49 +02:00
GeoSot
cc3e5789ec Remove some uncovered code that seems to be unused 2021-11-25 19:23:49 +02:00
GeoSot
92e664c921 Change check for dynamic modal 2021-11-25 19:23:49 +02:00
GeoSot
fc33ce4b46 Tweak methods
Name them to be more descriptive and have agnostic functionality
2021-11-25 19:23:49 +02:00
GeoSot
79e01c3bad Some refactoring on modal, to improve readability and generic functionality 2021-11-25 19:23:49 +02:00
GeoSot
94a596fbcb
Add a template factory helper to handle all template cases (#34519)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-11-25 19:14:02 +02:00
XhmikosR
367caea501
Update devDependencies (#35322)
* cspell                 ^5.12.4  →  ^5.12.6
* eslint                  ^8.1.0  →   ^8.2.0
* eslint-plugin-unicorn  ^37.0.1  →  ^38.0.1
* hugo-bin               ^0.76.1  →  ^0.77.2
* karma                   ^6.3.7  →   ^6.3.8
* linkinator             ^2.14.4  →  ^2.14.5
* postcss-cli             ^9.0.1  →   ^9.0.2
* rtlcss                  ^3.4.0  →   ^3.5.0
2021-11-09 08:02:36 +02:00
GeoSot
b991a6b851
tests: try to fix a few random failures (#35184)
* Change `Swipe` dispose spy on EventHandler
* Modal hide spy on backdrop hide
2021-10-13 17:45:39 +03:00
GeoSot
9640e2d5dd Change the way collapse handles its children on opening 2021-10-13 16:38:27 +03:00
GeoSot
1eea132866 collapse: extract duplicate code to a function 2021-10-13 16:38:27 +03:00
XhmikosR
e8f702666f
JS: minor refactoring (#35183)
* add missing comments
* shorten block comments
* reorder constants
* reorder public/private methods
* sort exports alphabetically in util/index.js
* fix a couple of typos
2021-10-13 15:19:28 +03:00
GeoSot
db44392bda
Swipe: add test to ensure that it ignores pinch events (#35161) 2021-10-12 15:48:19 +03:00
GeoSot
8ec6c94522
Extract Carousel's swipe functionality to a separate Class (#32999) 2021-10-11 17:04:43 +03:00
XhmikosR
24e3ca2474
tooltip.js: ignore a LGTM error (#35147)
The code on this line is either sanitized or the user chose to not sanitize it.
2021-10-10 14:49:41 +03:00
XhmikosR
c44d64ed71 Merge remote-tracking branch 'remotes/origin/v513' 2021-10-09 18:28:28 +03:00
XhmikosR
1a6fdfae6b Bump version to 5.1.3. 2021-10-09 09:43:19 +03:00
XhmikosR
a260967a55
tests: minor cleanup (#35138)
* tests: minor cleanup

* tests: use the util noop function
2021-10-08 12:32:11 +03:00
XhmikosR
eb0f705621
scrollspy.js: chain functions (#35139) 2021-10-08 12:28:05 +03:00
XhmikosR
64e13162fa
Sanitizer: fix logic and add a test. (#35133)
This was broken in 2596c97 inadvertently.
Added a test so that we don't hit this in the future.
2021-10-07 17:48:36 +03:00
XhmikosR
2596c97034
util/sanitizer.js: use Array.every() (#35120) 2021-10-06 00:23:14 +03:00
GeoSot
598b4c59a6 Use for...of in visual tests too 2021-10-05 19:52:11 +03:00
XhmikosR
3afe4b8c7d Enable unicorn/numeric-separators-style rule.
This is taken care of by babel via @babel/plugin-proposal-numeric-separator
2021-10-05 19:52:11 +03:00
XhmikosR
567a41347e Fix a unicorn/no-array-callback-reference issue 2021-10-05 19:52:11 +03:00
XhmikosR
666fe596bf Enable unicorn/no-array-for-each rule 2021-10-05 19:52:11 +03:00
XhmikosR
2b4d0d166b Enable unicorn/no-for-loop rule 2021-10-05 19:52:11 +03:00
XhmikosR
9f1579aa04 Enable unicorn/prefer-prototype-methods rule 2021-10-05 19:52:11 +03:00
XhmikosR
5ecef8ac01
Release v5.1.2 (#35114) 2021-10-05 18:50:18 +03:00
XhmikosR
c81c645394
rollup: specify generatedCode: 'es2015' (#35070)
This will make use of `const` and modern features (which we are already using in our code) in the generated rollup code.
2021-10-04 19:46:07 +03:00
XhmikosR
759fc89f4b
sanitizer: add sms in the SAFE_URL_PATTERN (#35074) 2021-09-29 07:41:06 +03:00
GeoSot
bdfb4cc54d
Fix Collapse regression of handling toggling between sibling chilldren (#34951) 2021-09-15 15:33:19 +03:00
XhmikosR
8f2e678424
Minor refactoring (#34980)
Rename variables and remove a temporary one
2021-09-15 14:34:24 +03:00
XhmikosR
c5d03d93fc
Rename e to event (#34979) 2021-09-15 14:27:46 +03:00
GeoSot
c9af4565fd
tests: fix lint warning (#34950) 2021-09-13 10:57:17 +03:00
Julien Déramond
499485589f
Remove remaining "master" branch references (#34932) 2021-09-08 17:58:50 +03:00
XhmikosR
0d81d3cbc1
Release v5.1.1 (#34869)
* Prepare v5.1.1.

* Dist
2021-09-07 18:37:44 +03:00
XhmikosR
23b3d636e1
Typo fixes (#34914) 2021-09-07 09:45:27 +03:00
XhmikosR
68a86d3477
BrowserStack: add Firefox 60 and Chrome 60 (#34912)
These are the minimum supported versions, so this patch makes sure everything works there too.
2021-09-06 21:54:08 +03:00
GeoSot
51afe026ca
Fix tooltip data-bs-original-title issue (#34842) 2021-08-31 16:11:22 +03:00
XhmikosR
ef21000cbe
tests: add Offcanvas too in jquery.spec.js (#34841) 2021-08-30 18:57:00 +03:00
XhmikosR
a7e64b5a4f
Add GitHub SHA in BrowserStack build ID. (#34077) 2021-08-30 16:30:51 +03:00
XhmikosR
c02805bb8c Move a few ESLint rules where they are needed. 2021-08-30 15:51:44 +03:00