Commit Graph

2185 Commits

Author SHA1 Message Date
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
XhmikosR 4a4b61f082 Update eslint-plugin-unicorn to v35.0.0 2021-08-30 15:51:44 +03:00
GeoSot c1fc1dbbee
Collapse on toggle, should not hide descendant tabpanels (#34835) 2021-08-30 15:29:02 +03:00
XhmikosR 40042ee503
visual tests: minor fixes (#34802) 2021-08-23 18:33:55 +03:00
Sébastien ALFAIATE 91295c2187
alert.js: Add missing newline (#34785) 2021-08-20 18:30:08 +03:00
GeoSot 1e5e655670
Fix modal when is triggered by `bs-toggle`, to hide other open instances (#34701) 2021-08-10 17:55:34 +03:00
XhmikosR 418fe8113e
carousel: move common checks to a function (#34621) 2021-08-10 17:50:32 +03:00
XhmikosR f20fece3a8
Prepare v5.1.0. (#34674) 2021-08-04 18:41:51 +03:00
GeoSot a6a2d1e2df
Regression on tooltip template creation process. (#34628)
* Regression on tooltip template creation process.

* check if template content does not exist, or given argument is empty

* call `setContent()` once.
2021-08-03 11:59:33 +03:00
XhmikosR 742269a734
tooltip: move repeated strings to constants (#34619) 2021-07-30 00:32:07 +02:00
XhmikosR 6d707f4801
Enable a few eslint-config-xo rules (#34620)
* unicorn/prefer-dom-node-append
* unicorn/prefer-dom-node-remove
2021-07-30 00:23:00 +02:00
GeoSot 2bf32ad180 transfer `interface` inside `jQueryInterface` 2021-07-29 16:30:02 +03:00
GeoSot e5b606d242 simplify initialization on `data-toggle` click 2021-07-29 16:30:02 +03:00
GeoSot 6f17e634ce keep parent only as element 2021-07-29 16:30:02 +03:00
GeoSot 4c1f7bb051 remove duplicated `Selector.find` 2021-07-29 16:30:02 +03:00
GeoSot 7a71703fd3 Simplify check for children 2021-07-29 16:30:02 +03:00
GeoSot 8fc4f3aaf3 initialize variable properly 2021-07-29 16:30:02 +03:00
GeoSot 1947ca033e Refactor internal function to use it in more cases.
Also, remove a few redundant checks since we already check for it in `_addAriaAndCollapsedClass()`.
2021-07-29 16:30:02 +03:00
GeoSot 5882d5dbe8 Add a helper function to check for showing
Also, remove the `isTransitioning()` helper.
2021-07-29 16:30:02 +03:00
GeoSot 4961ad0c63 Remove redundant check on `data-toggle` click.
Previously, it was assumed that the trigger element would have its own separate config than the collapse element itself.
2021-07-29 16:30:02 +03:00
GeoSot 2ad0a4a9fd streamline `_getConfig` & interface 2021-07-29 16:30:02 +03:00
GeoSot 4bfd8a2cbc
Use a streamlined way to trigger component dismiss (#34170)
* use a streamlined way to trigger component dismiss

* add documentation

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-07-28 17:39:32 +03:00
alpadev 047145e808
Fix `Manipulator.offset()` (#33603)
* test: add more test cases for Manipulator.offset()

* fix: Manipulator.offset() is using obsolete properties to get scroll position

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: GeoSot <geo.sotis@gmail.com>
2021-07-28 17:23:32 +03:00
Ryan Berliner 7646f6bd33
Add shift-tab keyboard support for dialogs (modal & Offcanvas components) (#33865)
* consolidate dialog focus trap logic

* add shift-tab support to focustrap

* remove redundant null check of trap element

Co-authored-by: GeoSot <geo.sotis@gmail.com>

* remove area support forom focusableChildren

* fix no expectations warning in focustrap tests

Co-authored-by: GeoSot <geo.sotis@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-07-27 08:01:04 +03:00
GeoSot 41292a5257
Toasts: Change showing timings and classes to keep toast `display:none` by default (#33610) 2021-07-22 18:13:13 +03:00
GeoSot e85a6ed77c make `dataApiKeydownHandler` to handle specific instance, avoiding extra manipulations 2021-07-22 17:54:48 +03:00
GeoSot 9916191311 extract createPopper method 2021-07-22 17:54:48 +03:00
GeoSot b1dad0943f handle click event in one place, remove undocumented click listener on element in case of not having the proper markup 2021-07-22 17:54:48 +03:00
GeoSot d01a08547d use classList `add` instead of `toggle` on show 2021-07-22 17:54:48 +03:00
GeoSot d130b00cad simplify toggle 2021-07-22 17:54:48 +03:00
GeoSot 3533e2d637 Merge `dropdownInterface` to `jQueryInterface` 2021-07-22 17:54:48 +03:00
GeoSot d3c6f25fd0 Add `isShown` method and reuse it 2021-07-22 17:54:48 +03:00
GeoSot da2db218ed Use on private method to set content & cleanup template 2021-07-22 17:20:38 +03:00
GeoSot 9c3ceaa25b popover: Move common code in tooltip's `getTipElement()` 2021-07-22 17:20:38 +03:00
GeoSot a97fd1cd24 use one private method to resolve string or function 2021-07-22 17:20:38 +03:00
GeoSot 3716603dbc Use `getOrCreateInstance` on `_initializeOnDelegatedTarget` 2021-07-22 17:20:38 +03:00
GeoSot 92c7056619 `_getDelegateConfig()`: add a comment and remove an unneeded config check 2021-07-22 17:20:38 +03:00
GeoSot c4e189df40 use a class private getter to decouple same methods usage 2021-07-22 17:20:38 +03:00
Ryan Berliner 119cfc3dfe
Remove whitespace at beginning of util/index.js (#34545) 2021-07-21 07:49:55 +03:00
GeoSot 5541179b38
Fix `Util.reflow` function and add documentation (#34543)
* add documentation to reflow function

* refactor to void as it should be

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-07-20 17:20:43 +03:00
GeoSot dfafb9a60c
modal: change `data-dismiss` so that it can be outside of a modal using `bs-target` (#33403)
* change data-dismiss, so can be outside modal, using a bs-target

* Update site/content/docs/5.0/components/modal.md

Co-authored-by: Gaël Poupard <ffoodd@users.noreply.github.com>
2021-07-19 16:56:05 +03:00
GeoSot e45b25e08e
util.js: remove `Selector.findOne()` dependency (#34441)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-07-14 09:08:10 +03:00
Mark Otto 359ed099e5 Add horizontal collapse support 2021-07-05 17:22:29 -10:00
Jeremy Jackson d314466a4d
Accept argument of different types in the `getInstance` method (#34333) 2021-06-29 17:45:45 +03:00
GeoSot 70dd7f6ff5
Changes to Alert component to match the others (#33402)
Alert.js: Refactor code to match the other components
* Use this._element
* Remove handleDismiss method and keep its functionality on event
* Change JqueryInterface to be more generic
* Correct docs to be aligned with code, and add undocumented functionality
* Update alerts.md

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-06-28 16:34:47 +03:00
Mark Otto 45d26de728 Variablize backdrop for modal and offcanvas 2021-06-25 13:41:15 -07:00
GeoSot f94f497ad5 ScrollSpy: Make Proper use of the SelectorEngine
* avoid extra work, creating ids
* simplify selectors and constrain search inside `config.target`
2021-06-22 19:50:21 -07:00
XhmikosR 688bce4fa6
Release v5.0.2 (#34276)
* Bump version to v5.0.2.

* Dist
2021-06-22 21:29:16 +03:00
alpadev 4927388197
Register only one `DOMContentLoaded` event listener in `onDOMContentLoaded` (#34158)
* refactor: reuse one DOMContentLoaded event listener in onDOMContentLoaded function

Instead of adding an event listener everytime the utility function is called, cache the callbacks and execute them all at once.

* refactor: drop iife for onDOMContentLoaded

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-06-22 20:19:55 +03:00
alpadev 290b9ee2cd
fix(carousel): arrow keys break animation if carousel sliding (#34307) 2021-06-22 13:11:03 +03:00
alpadev d62ba935ef
Fix carousel buttons (#34266)
* test(carousel): add test to check if next/prev button work as intended

* fix(carousel): merge passed config with instance config in carouselInterface
2021-06-16 07:48:23 +03:00
GeoSot cb47b8c964
Refactor scrollbar.js to be used as a Class (#33947) 2021-06-06 09:26:36 +03:00
GeoSot c98657b830
Add `getOrCreateInstance` method in base-component (#33276)
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-06-03 18:53:27 +03:00
alpadev 4a5029ea29
Fix handling of transitionend events dispatched by nested elements(#33845)
Fix handling of transitionend events dispatched by nested elements
Properly handle events from nested elements

Change `emulateTransitionEnd` to `executeAfterTransition` &&
2021-06-03 14:44:16 +03:00
Ryan Weaver 0cb70e214f
Changing Backdrop rootElement to default to a string (#34092)
The current config can cause the "body" to become stale. Specifically,
if the entire body element is swapped out for a new body element, then
the backdrop will continue to append itself to the original body element,
since it's stored in memory as a reference on this object.

This also no longer allows an explicit null to be passed to Backdrop's rootElement

This still accomplishes the laziness of "not finding the rootElement
until the Backdrop is created" to avoid problems of the JavaScript
being included inside <head> (so, before body is available).
2021-05-31 12:35:59 +03:00
GeoSot 544d9ac3cf
Change `element.parentNode.removeChild(element)` to `element.remove()` (#34071) 2021-05-25 18:30:38 +03:00
alpadev b513a19003
Fix prevented show event disables modals with fade class from being displayed again (#34085)
Fix modal, in case is faded, a prevented show event can cause show method to not  be executed again.
2021-05-24 18:52:36 +03:00
alpadev b39b665072
Automatically select an item in the dropdown when using arrow keys (#34052) 2021-05-22 10:58:52 +03:00
GeoSot e06e6dfe53
fix test of #34014 (#34070)
Fixes regression of a2b5901efc breaking the test runner because it would wipe document.body.
2021-05-22 02:54:32 +02:00
Ryan Weaver a2b5901efc
Fix bug where backdrop calls method on null if it is already removed from the body (#34014)
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-05-22 01:16:05 +03:00
Ryan Berliner 4ac711b5b4
Refactor `isVisible` helper, fixing false positives from deep nesting or alternate means (#33960) 2021-05-20 16:50:53 +03:00
GeoSot 79c3bf47bc
Add Tests on scrollbar.js & better handling if a style property doesn't exists (#33948)
* scrollbar.js:
add some tests
transfer test from modal.spec. to scrollbar.spec
proper handling if style property doesn't exist
2021-05-20 16:29:04 +03:00
GeoSot 9e4f87ae8f
Allow use of `dispose/hide` methods on Tooltip & Popover from jQueryInterface, when component does not exists. (#33371) 2021-05-20 16:16:55 +03:00
GeoSot df72a21fa8
Add `getNextActiveElement` helper function to utils, replacing custom implementation through components (#33608) 2021-05-19 01:23:52 +03:00
GeoSot 2757fbe28e
Reset inside a Dialog does not work if `data-dismiss="modal"` is set (#33928) 2021-05-18 09:26:22 +03:00
Rohit Sharma 153cf3a235
Don't add empty content holder when there is no content available (#33982)
* Remove content holder when there is no content

* Add tests to check the removal of header/content

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-05-18 09:02:39 +03:00
XhmikosR 58b1be927f
Release v5.0.1 (#33972)
* Bump version to 5.0.1.

* Dist
2021-05-13 19:22:20 +03:00
GeoSot 6e1c9096f0
Move get element functionality to a helper (#33327)
Looking around on js components I found out many checks, different expressed but with same purpose.
Some of them are trying to parse string to element, others, jQuery element to js simple nodeElement etc

With this Pr, I am trying to give a standard way to parse an element

So this pr:

* Creates `getElement` helper that tries to parse an argument to element or null
* Changes `isElement` to make  explicit checks and return Boolean 
* fixes tests deficiencies
2021-05-13 18:17:20 +03:00
GeoSot 9a9e22475c
Popover/Tooltip: streamline config property to start with underscore (#33381) 2021-05-12 12:15:59 +03:00
GeoSot d794e8970b
Fix test warning for dropdown, without expectations (#33938)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-05-11 12:54:51 +03:00
GeoSot 8d1b0fb779
Fix offcanvas test to expect the initial body `overflow` value (#33927)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-05-11 11:06:32 +03:00
GeoSot 9fe36edf68
Extract static `DATA_KEY` & `EVENT_KEY` to base-component (#33635)
* Force each plugin that extends base-components to implement a static method `NAME()`
* Remove redundant `NAME` argument from 'Utils.defineJQueryPlugin' & fix test
2021-05-11 10:49:30 +03:00
alpadev 7647b8fe5b
Fix: Click on input outside of dropdown-menu prevents dropdown from closing (#33920)
* test: add test if user clicks on input not contained within dropdown-menu

* fix: click on inputs that are not contained within dropdown-menu prevent dropdown from closing
2021-05-11 09:09:00 +03:00
GeoSot 03842b5f25
Refactor: move disposing properties into the base class (#33740)
Moves more functionality to `base-component`, transferring the responsibility of disposal to parent class.
Each component, dusting disposal, sets its protected properties to `null`. So the same can be done in one place for all children components .
2021-05-11 09:04:42 +03:00
Ben Lertlumprasertkul 052def4568
Remove potential false positive assertions (#33288)
* Remove potential false positive assertions

querySelector() returns null but

expect(document.querySelector('...')).toBeDefined()

tests that the value is not undefined

* Migrated assertions from .toBeDefined() to .not.toBeNull() for .getInstance() calls in tests

* Migrate offcanvas assertions from .toBeDefined() to .not.toBeNull() for .getInstance() call

* convert more cases to not.toBeNull assertions

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-05-11 08:45:57 +03:00
Ryan Berliner 9c3ab6557e
Prevent toast autohiding if focusing or hovering (#33221) 2021-05-11 08:37:57 +03:00