Commit Graph

789 Commits

Author SHA1 Message Date
GeoSot 1c02ef4f97
Allow offcanvas to be initialized in open state (#33382)
* Update docs to use new .show behavior and clarify some copy for first example

Co-authored-by: Mark Otto <markdotto@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-23 08:22:59 +02:00
Patrick H. Lauke 3ce0a8d3ec
Dynamic tab should not show when triggered on `disabled` element (#33257)
* show() should bail if the trigger has `disabled` attribute

* use 'isDisabled' helper

Co-authored-by: GeoSot <geo.sotis@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-17 10:52:40 +02:00
GeoSot b9f30903a5
Fix carousel RTL and refactor code, fix rtl swipe issues (#32913)
* move common code to reusable functions

* add/re-factor tests, directionToOrder func

* add _orderToDirection tests

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-17 07:58:43 +02:00
GeoSot c5083d5fc3
Use more safe check for 'isDisabled' helper (#33385) 2021-03-17 07:44:15 +02:00
GeoSot ddf72bc612
Accept data-bs-body option in the configuration object as well (#33248)
* Accept data-bs-body option in the configuration object as well

Tweak jqueryInterface, add some more tests

* Fix Markdown table formatting and tweak the wording on backdrop

Co-authored-by: Mark Otto <markdotto@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-16 18:35:03 +02:00
Ryan Berliner 99b2c0b390 only trigger tooltip inserted event on true dom insert 2021-03-16 07:48:50 +02:00
Ryan Berliner 72d2313579 reuse existing popper on show during tooltip fadeout 2021-03-16 07:48:50 +02:00
Ryan Berliner 6ef70b342c prevent quick interactions from misplacing tooltips 2021-03-16 07:48:50 +02:00
Ryan Berliner d491c29aa0 prevent tooltip from being deleted on quick re-activations 2021-03-16 07:48:50 +02:00
Rohit Sharma 6ecd1c626e
Change the name of the `Offcanvas` constructor (#33261) 2021-03-16 07:21:04 +02:00
GeoSot e163d98845
modal: move common code to a new `isAnimated` method (#33056) 2021-03-08 18:35:59 +02:00
GeoSot 548be2ed66
Offcanvas as component (#29017)
* Add a new offcanvas component

* offcanvas.js: switch to string constants and `event.key`

* Remove unneeded code

* Sass optimizations

* Fixes

Make sure the element is hidden and not offscreen when inactive
fix close icon negative margins
Add content in right & bottom examples
Re-fix bottom offcanvas height not to cover all viewport

* Wording tweaks

* update tests and offcanvas class

* separate scrollbar functionality and use it in offcanvas

* Update .bundlewatch.config.json

* fix focus

* update btn-close / fix focus on close

* add aria-modal and role
return focus on trigger when offcanvas is closed
change body scrolling timings

* move common code to reusable functions

* add aria-labelledby

* Replace lorem ipsum text

* fix focus when offcanvas is closed

* updates

* revert modal, add tests for scrollbar

* show backdrop by default

* Update offcanvas.md

* Update offcanvas CSS to better match modals

- Add background-clip for borders
- Move from outline to border (less clever, more consistent)
- Add scss-docs in vars

* Revamp offcanvas docs

- Add static example to show and explain the components
- Split live examples and rename them
- Simplify example content
- Expand docs notes elsewhere
- Add sass docs

* Add .offcanvas-title instead of .modal-title

* Rename offcanvas example to offcanvas-navbar to reflect it's purpose

* labelledby references title and not header

* Add default shadow to offcanvas

* enable offcanvas-body to fill all the remaining wrapper area

* Be more descriptive, on Accessibility area

* remove redundant classes

* ensure in case of an already open offcanvas, not to open another one

* bring back backdrop|scroll combinations

* bring back toggling class

* refactor scrollbar method, plus tests

* add check if element is not full-width, according to #30621

* revert all in modal

* use documentElement innerWidth

* Rename classes to -start and -end

Also copyedit some docs wording

* omit some things on scrollbar

* PASS BrowserStack tests

-- IOS devices, Android devices and Browsers on Mac, hide scrollbar by default and appear it, only while scrolling.

* Rename '_handleClosing' to '_addEventListeners'

* change pipe usage to comma

* change Data.getData to Data.get

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Martijn Cuppens <martijn.cuppens@gmail.com>
Co-authored-by: Mark Otto <markdotto@gmail.com>
2021-03-02 19:10:10 +02:00
Rohit Sharma b9e51dc3c4
Dropdown — Drop `flip` option (#33198) 2021-03-02 17:27:13 +02:00
alpadev 48a95f7280
refactor: use a Map instead of an Object in dom/data (#32180)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-03-02 16:55:44 +02:00
Muhammadamin 056216a3bd
modal: don't add margin & padding when sticky is not full width (#30621)
* modal: don't add margin & padding when sticky is not full width

* Check if element is shorter than window

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-02-23 14:52:09 +02:00
Rohit Sharma dc5e3328c1
Allow constructors to accept a CSS selector (#32245)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <otto@github.com>
2021-02-22 09:01:04 +02:00
Nikon the Third e8f08d1802
Adjust regex `SAFE_URL_PATTERN` for use with test method of regexes. (#33136)
The test method on regexes behaves different than the match method on strings in the presence of the global modifier.
Add a unit test for sanitizing the same template twice.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-19 10:24:53 +02:00
nlipka 536c53c16c add some space 2021-02-18 08:19:15 -08:00
XhmikosR 92434fa30f
util: change `isRTL` to a function (#32446)
This allows the bundler to tree-shake the function.
2021-02-16 10:14:05 +02:00
Kyle Tsang 02dbd87ffa
Fix event handler removal in dropdown/carousel dispose (#33000)
* Fix event handler removal in carousel dispose

* Fix event handler removal in dropdown dispose

* Test event handlers in scrollspy dispose

* Test event handlers in toast dispose

* Test event handlers in tooltip dispose

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-02-12 07:51:34 +02:00
XhmikosR e50c11b8c6
Release v5.0.0-beta2 (#32467)
* Bump version to 5.0.0-beta2

* Dist
2021-02-10 18:14:51 +02:00
Rohit Sharma f7088e5d28
Add function type for `popperConfig` option (#32882)
* Add function type for `popperConfig` option

* Update .bundlewatch.config.json

* copy edits

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <markdotto@gmail.com>
2021-02-09 21:16:13 +02:00
Rohit Sharma 29e0c9dfa1
Dropdown — Change the selector to check the use of Popper (#33003)
* Create the popper instance first

Make sure that popper instance has been created first and then apply the
styling on the dropdown(menu)

* Use `data-bs-popper` attibute to check popper

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-09 21:04:23 +02:00
Mark Otto 8f1c882545 Remove .dropdown-menu[style] reset and adjust .dropdown-menu-* modifiers
- Removes the &[style] selector that was used for resetting Popper styles
- Separate Popper-based alignment from static alignment with `data-bs-popover` attribute that separates the --bs-position and custom right/left properties

Co-Authored-By: Rohit Sharma <rohit2sharma95@gmail.com>
2021-02-09 14:34:27 +02:00
Rohit Sharma 0eaa6c05cf
Remove custom `fallbackPlacements` from dropdown (#32843) 2021-02-09 07:55:17 +02:00
Kyle Tsang d63a922436
Fix Popper preventOverflow boundary config (#32845)
Currently, the boundary config is being assigned to the wrong var (`rootBoundary`) in the popper config.  It should be assigned to the `boundary` var in popper's config.

Ref: https://popper.js.org/docs/v2/utils/detect-overflow/#boundary
2021-02-04 06:55:25 +02:00
Siju Samson b376a3d80d
Fix dropdown keys to open menu (#32750)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 22:03:21 +02:00
Florian Vick 2a9d72133d
Prevent `getSelector` from returning URLs as selector (#32586)
* added checks to getSelector in util to prevent returning hrefs that are invalid selectors

* restored compatibility for the class selector and added test cases for keeping urls from being returned as a selector

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 21:58:54 +02:00
Rohit Sharma 3770b7b9e3
Dropdown — Emit events on the `.dropdown-toggle` button (#32625)
* Emit events on the dropdown button

Emit the events on `.dropdown-toggle` button and then bubble up

* Add migration note for events

* Update the docs for events

* Add unit test to check the event bubbling

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 21:51:19 +02:00
Rohit Sharma 217d84d6b2
Remove the initial margin from dropdown/popover in favor of Popper (#32524)
* Remove the margin from dropdown in favor of Popper

- Set the default margin to 0 for dropdowns (To remove the Popper's  warning)
- Set the required offset in dropdown's defaults

* Remove the margin from the popover component

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 21:37:25 +02:00
Rohit Sharma e79c8f3489 Just find the active indicator 2021-01-28 23:32:24 +02:00
Patrick H. Lauke a882614c45 Make carousel indicators actual buttons 2021-01-28 23:32:24 +02:00
Rohit Sharma b1bd54955e Restore `offset` option for tooltip/popover components 2021-01-28 12:23:33 +02:00
joke2k 881f43a3b9 Restore offset option for dropdown component 2021-01-28 12:23:33 +02:00
GeoSot 5d7b51e1d0
Tooltip refactoring (#32523)
* tooltip: move common code to a reusable function

* tooltip: return early in `show()`

Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-27 19:01:24 +02:00
GeoSot b5bf3131fb
modal: move common code to reusable functions (#32511)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-14 21:22:09 +02:00
dependabot[bot] 1b46601ce8
Bump eslint-plugin-unicorn from 25.0.1 to 26.0.1 (#32784)
* Bump eslint-plugin-unicorn from 25.0.1 to 26.0.1

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 25.0.1 to 26.0.1.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v25.0.1...v26.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Updates for `eslint-plugin-unicorn@26.0.1`

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-14 00:29:26 +02:00
Rohit Sharma c9cd741aff
Throw a `TypeError` instead of the generic `Error` (#32585)
* Change from Error to TypeError

* Convert the `NAME` to upper case to make the consistency in the error message

* Update the remaining tests to be stricter

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-13 22:13:30 +02:00
Rohit Sharma e34481b6eb
Fix toggling modal when clicking on `data-bs-toggle="modal"` (#32691)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-13 21:59:47 +02:00
Rohit Sharma 3c934ddcef
Scrollspy - Remove unnecessary event argument (#32603)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-07 09:34:08 +02:00
Daniele Faraglia 59cd71631e
collapse: prevent url change if `A` nested tag is clicked (#32438)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-21 14:37:35 +02:00
Nils K 2d46e47464
Support Popper virtual elements (#32376)
Adds the ability to use objects implementing the virtual element interface as the value for the reference option of a dropdown config.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-21 14:32:11 +02:00
Rohit Sharma 042a4a255f
Tooltip/popover - change the default value for `fallbackPlacements` (#32437)
The default Popper `fallbackPlacements` value is `[oppositePlacement]`.

- The default value was previously (in v4) `'flip'` that can be achieved by passing the single value in the array, like — `[oppositePlacement]`. Keeping `null` also sets the `fallbackPlacements` to `[oppositePlacement]` (Default value in Popper)
- It's better to have **clockwise** (`['top', 'right', 'bottom', 'left']`) fallback options so that tooltip/popover can be placed to another side even if the opposite placement doesn't fit.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-14 20:51:14 +02:00
Gaël Poupard b85ca045e0 fix(carousel): switch prev/next directions in RTL 2020-12-14 11:11:47 +02:00
XhmikosR 93ab072027
carousel: switch to string constants (#32393) 2020-12-11 16:12:13 +02:00
XhmikosR d154f0df7f
Use the ternary operator in a few more places (#32303) 2020-12-11 15:47:34 +02:00
Rohit Sharma 4535b09c46
Tooltip - check if tip and its parent node exist in dispose method (#32420) 2020-12-10 21:06:41 +02:00
XhmikosR 1edec546cb
Remove `TRANSITION_END` from utils (#32394) 2020-12-10 16:54:50 +02:00
XhmikosR 6f9c38f65e
carousel: switch to `if/else` (#32395)
There are only two conditions, so `if/else` is shorter and has the same effect.
2020-12-10 00:38:24 +02:00
Martijn Cuppens f132400865 Add fallback behaviour 2020-12-09 13:34:51 -08:00
XhmikosR 0ca5addea4
alert: rename variables for consistency (#32392) 2020-12-09 15:09:41 +02:00
XhmikosR 41bc0e26d2
SelectorEngine: drop variable used once (#32391) 2020-12-09 15:05:52 +02:00
alpadev 85208ae557
Refactor components to use a utility function to define jQuery plugins (#32285)
* refactor: use an utility function to define jQuery plugins

* test: add spec for defineJQueryPlugin utility function

* Update .bundlewatch.config.json

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-08 08:16:50 +02:00
XhmikosR d15a0247ce
Remove `SelectorEngine.matches()`. (#32339)
It's basically unused.
2020-12-07 19:10:20 +02:00
XhmikosR 8dc85c657e Prepare v5.0.0-beta1. 2020-12-07 18:18:16 +02:00
XhmikosR 4eea630d16 Be explicit with `element.closest()`'s return value 2020-12-06 18:42:40 +02:00
Martijn Cuppens d8f247392d Fix conflict with Bootstrap CSS 2020-12-06 18:42:40 +02:00
Johann-S adfdf7160b Update to popper.js v2.x 2020-12-06 18:42:40 +02:00
Gaël Poupard 9488978fb5 feat(RTL): implement RTL
Using RTLCSS directives, renaming things to use logical names and following best practices.
2020-12-04 07:52:03 +02:00
XhmikosR 701c6c6e77
Unbreak lines. (#32304) 2020-12-02 06:45:15 +02:00
Rohit Sharma c3689ac073
Remove the `show` property from the modal plugin (#32279)
Drop the support of show property from the modal plugin.
When creating the new modal instance in v5, the `show` property does not work anymore, so instead of fixing the behavior just removing it permanently to keep the consistency between all the plugins. (All other plugins require the `show()` method to be called on the instances to be shown)

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-30 12:12:40 +02:00
XhmikosR 03ed3e0b3b tooltip.js: reuse existent variable 2020-11-30 12:07:51 +02:00
Patrick H. Lauke adc857f617 Extra check for existence of any `aria-label`
before overwriting it...
2020-11-30 12:07:51 +02:00
Matty Williams b0372bb658 Accessibility update for tooltip.js
Update to the tooltip.js to add an aria-label attribute that contains the original title of the element, but only if the element doesn't have an existing aria-label attribute.

This is to address cases where screen readers are not capturing the aria-describedby attribute that is added when the tooltip is triggered.  This should also avoid a race condition between the screen reader and the appearance of the tooltip.
2020-11-30 12:07:51 +02:00
Rohit Sharma 04674f88b0 Remove setData from construtors (#32264) 2020-11-29 20:58:26 +02:00
Johann-S 4999c3dbbc remove data key in base component 2020-11-29 20:58:26 +02:00
Rohit Sharma f6a8733741 Move `VERSION` to BaseComponent (#32254) 2020-11-29 20:58:26 +02:00
Johann-S 9eb9d02084 add dispose in base component 2020-11-29 20:58:26 +02:00
Johann-S 9f6b342dc7 create a base component 2020-11-29 20:58:26 +02:00
Rohit Sharma c348ad4a94
Ability to add custom class in tooltip/popover (#32217)
Porting of #31834 to main.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-25 09:16:22 +02:00
XhmikosR f4457bca02
Be consistent with Popper's name. (#32224)
The npm package is named "popper.js" but the project is named "Popper", so use the latter consistently.
2020-11-21 16:22:08 +02:00
Rohit Sharma 0839cbf04d
Don't hide modal when keyboard is set to false in modal's configuration (#32179)
* Don't hide modal when config.keyboard is false

* Update unit test

- Modal should not be closed when pressing esc key if keyboard = false
  and backdrop is 'static'

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-20 15:36:24 +02:00
Rohit Sharma 2630b05eb3
Make the attribute methods bs specific (#32173)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-20 11:13:13 +02:00
XhmikosR eaf616c653 Use `Array.find` instead of `Array.filter` 2020-11-14 15:54:50 +02:00
XhmikosR 53ec604eb1 Use `String.startsWith` 2020-11-14 15:54:50 +02:00
XhmikosR 6d7bc54d22 Switch to `Set#has()` 2020-11-14 15:54:50 +02:00
XhmikosR 2e758f64cf Switch to Number properties 2020-11-14 15:54:50 +02:00
XhmikosR b9f7668cf6 Switch to `String.includes()` 2020-11-14 15:54:50 +02:00
XhmikosR 470e99ed5f
tooltip.js: deduplicate `_fixTitle()` (#32124) 2020-11-14 15:43:25 +02:00
Rohit Sharma e530118117 Get only bs prefixed data attributes 2020-11-14 07:09:15 +02:00
Rohit Sharma 418f17ee2b Add `bs` in data attributes
- Add `bs` in data APIs everywhere
- Update unit tests
2020-11-14 07:09:15 +02:00
XhmikosR 384eccbfaf
Prepare v5.0.0-alpha3 (#32122) 2020-11-11 19:07:37 +02:00
XhmikosR 13572a6867 Remove the now unneeded polyfills. 2020-11-05 15:37:34 +02:00
XhmikosR e8f1709adf Drop Legacy Edge support.
This allows us to move forward without being held back. Microsoft already replaces the Legacy Edge with the new one on supported Windows versions.
2020-11-05 15:37:34 +02:00
XhmikosR b864973a94
dropdown.js: simplify code (#32055) 2020-11-03 16:43:20 +02:00
XhmikosR 59692ce862
karma: stop excluding polyfill.js from istanbul (#30740) 2020-11-01 15:52:24 +02:00
XhmikosR 421e2482e2
Streamline jQuery comment. (#32016) 2020-11-01 15:49:51 +02:00
Sascha c21506d499
Fix TypeError when Bootstrap is included in `head` (#32024)
* extend jquery after domContentLoaded event is fired

* add unittest for util onDOMContentLoaded

* wait for trigger jquery event after domContentLoaded

* remove domcontentready from eventHandler

* move istanbul ignore statements to correct line

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-01 15:32:36 +02:00
Mitchell Bryson 3a5f9f5cf0
Check for data-interval on the first slide of carousel (#31818)
* check for data-interval on the first slide of carousel

* add updateInterval method for elements of a carousel

* add test for carousel interval being set during cycle

* update activeElement as soon as slide has finished (before transition end)

* only updateInterval before using it

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-01 14:36:50 +02:00
XhmikosR e6f8428b28
polyfill.js minor tweaks (#32011)
* rename function to `supportsScopeQuery`
* use a ternary in `findOne` function return value
2020-11-01 07:38:55 +02:00
XhmikosR 0c1651ee9d
Remove `Manipulator.toggleClass` (#31842)
It's only used in one place so it makes more sense to remove it for the time being.
2020-10-05 18:07:49 +03:00
XhmikosR b083c9639f
Prepare v5.0.0-alpha2. (#31748) 2020-09-29 18:33:00 +03:00
Hiws 43b4252a34
fix tooltip hide method when already hidden (#31115)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-09-24 14:55:38 +03:00
XhmikosR b345746bb6 Join template literals 2020-07-12 15:52:25 +03:00
XhmikosR 6d86b140f9 Add parentheses around multiple spread conditions 2020-07-12 15:52:25 +03:00
XhmikosR a67231ae1c Move function 2020-07-12 15:52:25 +03:00
XhmikosR 0eb120eea0 tooltip.js: remove variable used once. 2020-07-12 15:52:25 +03:00
XhmikosR b97fcd3289 scrollspy.js: minor refactoring 2020-07-12 15:52:25 +03:00
XhmikosR f15af45c6e Unbreak lines. 2020-07-12 15:52:25 +03:00
Rohit Sharma 91c11d6465
toasts: make default duration 5s (#31109)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-07-12 15:43:26 +03:00
Rohit Sharma f6348f6c89
Clear timeout before showing the toast (#31155)
* clear timeout before showing the toast

* Add unit test

* Remove the check for timeout

* Check for clearTimeout to have been called

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-07-11 11:51:04 -07:00
Shohei Yoshida fb4efb49ea
Prevent overflowing static backdrop modal animation (#30326)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-06-25 11:35:53 +03:00
Patrick H. Lauke edbcc401c2
Change whitelist to allowlist (#31066)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <markd.otto@gmail.com>
2020-06-19 11:31:37 +03:00
Tanguy Krotoff d80a9fc553
Fix tooltip when hovering a children element (delegateTarget) (#30928)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-06-18 10:02:44 +03:00
XhmikosR 12b754800c collapse.js: return early. 2020-06-17 16:58:56 +03:00
XhmikosR 8debdf6ce6 Remove a couple of variables used once 2020-06-17 16:58:56 +03:00
XhmikosR 94a5d87e15 Unbreak short lines 2020-06-17 16:58:56 +03:00
Johann-S 088c727a31 data: reword storage key in dom 2020-06-17 15:45:36 +02:00
XhmikosR c28934cb18
Rename "master" to "main". (#31050) 2020-06-16 21:41:47 +03:00
Martijn Cuppens 1a0a0858ef Remove checkbox/radio toggle from button plugin in favor of a CSS only solution 2020-06-15 19:04:19 -07:00
Rohit Sharma 5faf41eb48
Add role="dialog" in modals via JavaScript (#30936) 2020-06-04 10:35:09 +03:00
XhmikosR 7966167cf6
Replace double tilde with `Math.floor` (#30691)
Nowadays, browser engines have improved a lot and `Math.floor` is the same, if not faster.
Also, clarity is better than micro-optimizations in this case.
2020-05-14 09:46:42 +03:00
XhmikosR b07b342086
Partially Revert "Use regex.test() when we want to check for a Boolean. (#29969)" (#30770)
This partially reverts commit 9c2b9ac74d.
2020-05-13 22:49:41 +03:00
XhmikosR 38ec7c4df7
Bump version to 5.0.0-alpha1 (#29925)
Also add v4.5.0 in versions and keep README.md pointing to v4.5.0 so that there are no broken stuff.
2020-05-13 22:36:00 +03:00
Giovanni Mendoza 3e7566f2c3 Avoid bad scrollbar replacement into width values 2020-05-12 07:51:09 +03:00
XhmikosR 737b6925ab Revert "Avoid bad scrollbar replacement into width values (#30690)"
This reverts commit 85c4788ded.
2020-05-06 21:25:59 +02:00
Johann-S f91788548c
enforce element check on scrollspy target (#30747) 2020-05-06 07:30:43 +03:00
XhmikosR 727e09b641
scrollspy.js: remove temporary variable (#30724) 2020-05-04 19:43:50 +03:00
Johann-S 85c4788ded
Avoid bad scrollbar replacement into width values (#30690) 2020-04-29 22:28:20 +03:00
Martijn Cuppens c8d68fbec7
Drop closest from SelectorEngine (#30653)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-04-28 22:17:23 +03:00
Tanguy Krotoff 7787f642b9 Fix crash when pressing ArrowUp the first time 2020-04-17 18:22:15 +03:00
Tanguy Krotoff d7f0f1aac9 Replace event.delegateTarget with event.target
No need for fixEvent() anymore
2020-04-17 18:22:15 +03:00
Tanguy Krotoff dcd99aa7d1 Replace event.which with event.key and event.button 2020-04-17 18:22:15 +03:00
XhmikosR 8547ab149a
collapse: don't rely on implicit conversion (#30566)
`config` can be an `Object` and we only need to test for `hide` or `show` if it's a `String`
2020-04-17 15:09:51 +03:00
XhmikosR 9a5033d413
Pass multiple classes to `classList.add` / `classList.remove` (#30537)
This is supported by our currently supported browsers.
2020-04-09 20:56:43 +03:00
ysds dfa017adc3 Always modal scroll top to 0 2020-04-01 10:05:43 +03:00
XhmikosR e1f5d819c7
Remove `MSPointerEvent` and `ms-touch-action` in tests (#30463) 2020-03-29 09:59:54 +03:00
XhmikosR ed94976ea8
Use `textContent` instead of `innerText`. (#30462)
It's supported by all of our supported browsers.
2020-03-29 09:53:57 +03:00
Johann-S 26d86fce2a
fix: remove make array util function (#30430) 2020-03-25 16:35:02 +02:00
Martijn Cuppens 2e150e722a Use next dropdown menu instead of first of the parent 2020-03-23 15:35:07 +01:00
Johann-S 47aef7b2c6 Remove IE compatibility JS code 2020-03-18 20:59:27 +02:00
Johann-S aff115219e
fix: ensure `totype` always returns stringified null/undefined when null/undefined is passed (#30383) 2020-03-18 13:10:55 +02:00
XhmikosR 38333feda5 Switch to strings constants.
This allows the minifier to mangle the constants. It also allows the linter to find unused strings properly.

While at it, remove a few unused properties.

File                        Before      After       Diff
--------------------------------------------------------
bootstrap.bundle.min.js     23.61 kB    22.61 kB    -1.00 kB (-4.23 %)
bootstrap.min.js            17.04 kB    16.08 kB    -0.96 kB (-5.63 %)
2020-03-18 12:58:54 +02:00
Sparks c47547cd09
Improvement: harmonize usage of constants (#30285) 2020-03-09 17:26:29 +02:00
Martijn Cuppens 7d8c7c4ba8
`prev()` function fails when non-element nodes are present (#30117)
The `prev()` function doesn't take nodes other than elements into account. Also we could simplify things a lot using the `previousElementSibling` property. This property isn't fully supported in IE, it only works for elements, but since the `element` variable is an element, we can safely use it here.

I've also added an additional test.

I don't think we had this issue in v4, since we relied on jQuery back then.

Ref. https://developer.mozilla.org/en-US/docs/Web/API/NonDocumentTypeChildNode/nextElementSibling
2020-03-09 17:21:04 +02:00
Giovanni Mendoza 954a0b1e6a Close modal with keyboard=true & backdrop=static (#29986)
* Close modal with keyboard=true & backdrop=static
2020-01-10 11:06:12 +02:00
XhmikosR 5638499aba
sanitizer.js: Add srcset in the allowed attributes (#29968) 2020-01-07 22:46:28 +02:00
XhmikosR 5d1da6377d Fix the new lint errors. 2020-01-07 22:25:50 +02:00
XhmikosR 9c2b9ac74d
Use regex.test() when we want to check for a Boolean. (#29969) 2020-01-07 22:07:51 +02:00
Steffen Roßkamp c62efc3ef6 Update normalizeDataKey to match the spec (#29609) 2019-10-31 07:58:09 +02:00
Higor Araújo dos Anjos 46912797b2 Added animation when modal backdrop is static (#29516) 2019-10-25 21:12:09 +03:00
Jeremy Jackson c1ee395f80 Skip hidden dropdowns while focusing (#29523) 2019-10-17 18:01:44 +03:00
XhmikosR 622c914a3a
Update devDependencies. (#29447) 2019-10-07 09:31:12 +03:00
Johann-S 3d12b541c4 return to the original file structure to avoid breaking modularity 2019-10-03 09:55:57 +02:00
XhmikosR 6cb4ebc048
ESLint: specify `--report-unused-disable-directives` (#29350) 2019-09-02 12:44:19 +03:00
Johann-S a5cbb5e71a dropdown show method should do the same as toggle 2019-08-25 15:54:22 +02:00
Markus Hatvan 4d101491da Remaining JS linting TODO (#29289)
* Enable and fix all occurrences with no-mixed-operators rule
* Take care of the max-depth warning in button.js

Signed-off-by: mhatvan <markus_hatvan@aon.at>
2019-08-22 22:17:34 +03:00
Johann-S 6885d65578 dropdown - destroy old popper.js references 2019-08-22 20:30:16 +02:00
Johann-S a9c35b3ca8 Remove useless check for null object with spread operator 2019-08-18 17:19:36 +03:00
XhmikosR 9cee3c2808 Minor wording tweaks 2019-08-18 17:19:36 +03:00
Johann-S f03c10a189 allow to pass popper.js configuration for tooltip/popover and dropdown 2019-08-18 17:19:36 +03:00
Johann-S 8b2b490f9b add a way to disable jQuery detection 2019-08-02 16:50:05 +02:00
XhmikosR eecd75db00
Fix typos. (#29178) 2019-07-31 16:14:21 +03:00
Johann-S dcba526775 remove underscore for static methods 2019-07-29 11:34:12 +02:00
Johann-S 2ea71a9e78 allow dynamic modal body for scrollable modals 2019-07-28 12:11:10 +02:00
Johann-S fc02932946 use get selector from element only when needed 2019-07-24 11:27:35 +02:00
Johann-S e48e498bf4 fix arrow popover (#29115) 2019-07-24 10:53:58 +03:00
Shohei Yoshida ebb1eea520 Force reflow for fade-in animation (#29113) 2019-07-23 17:21:23 +03:00
Johann-S 233f3fb1ce rewrite tab unit tests 2019-07-23 14:23:50 +02:00
Johann-S e1b5d8471a use qunit css for our fixture 2019-07-23 14:23:50 +02:00
Johann-S b7b56cb10a rewrite scrollspy unit tests 2019-07-23 14:23:50 +02:00
Johann-S 85b70cef3c rewrite tooltip unit tests 2019-07-23 14:23:50 +02:00
Johann-S c9e650a56f rewrite popover unit tests 2019-07-23 14:23:50 +02:00
Johann-S 1ac07a66ce rewrite modal unit tests 2019-07-23 14:23:50 +02:00
Anton Bershanskiy e916a9bc03 rewrite toast unit tests 2019-07-23 14:23:50 +02:00
Johann-S 6a59c58480 rewrite dropdown unit tests 2019-07-23 14:23:50 +02:00
Johann-S 0ed1618c06 rewrite collapse unit tests 2019-07-23 14:23:50 +02:00
Johann-S 62730d9afd rewrite carousel unit tests 2019-07-23 14:23:50 +02:00
Johann-S 747f0f4c7b test jquery interface for our alert plugin 2019-07-23 14:23:50 +02:00
Johann-S 891a187059 rewrite button unit tests 2019-07-23 14:23:50 +02:00
Johann-S c834895fa0 rewrite unit tests for selector engine 2019-07-23 14:23:50 +02:00
Anton Bershanskiy fe6ba2384a rewrite manipulator unit tests 2019-07-23 14:23:50 +02:00
Johann-S c8c2074650 Switch from QUnit to Jasmine. 2019-07-23 14:23:50 +02:00
Patrick H. Lauke f0f75379f6 Closing dropdown with ESC correctly sets focus to toggle (#28928)
Just firing the focus event isn't enough ... need to actually call the proper `focus()` method for it to actually do it...
2019-06-19 12:23:41 +03:00
david-lallement 0829decce0 tooltip dispose:removing only own event handler (#28896) 2019-06-13 10:42:54 +02:00
XhmikosR 8a79cf894d event-handler.js: use a plain for loop. (#28853) 2019-06-03 13:08:17 +02:00
Johann-S d5752a18ab toast should allow prevent default for hide and show events 2019-05-16 13:24:29 +02:00
Johann-S c805aec770 fix popover arrow by selecting the first element child 2019-05-14 15:28:43 +02:00
XhmikosR 438e01b61c Rename `eventHandler` and `selectorEngine` files. 2019-05-08 17:26:37 +03:00
XhmikosR afc63ec887 Fix xo error: use `for...of`. 2019-04-10 15:18:57 +03:00
ysds f4877dbf03 Remove _close() and marge with _hide() 2019-04-09 13:59:41 +02:00
ysds 91ebb4b3b2 Call hide() after `delay` time 2019-04-09 13:59:41 +02:00
Johann-S 1752addadf Reset carousel touch delta x to prevent click transformation in swipe (#28558) 2019-03-27 14:37:04 +02:00
Johann-S 08679ac0b5 Add back support for IE 11 2019-03-18 01:11:05 +02:00
XhmikosR 6aa475c82e
Use one-line imports when possible. (#28467) 2019-03-13 14:55:53 +02:00
Johann-S 2fd50f98a5 build bootstrap in esm 2019-03-11 17:59:08 +02:00
XhmikosR 3ffe3a5d82 collapse.js: minor refactoring. 2019-03-11 17:01:28 +02:00
XhmikosR 1393678f0b Remove obsolete comments. 2019-03-11 17:01:28 +02:00
XhmikosR dd0239d169 Remove more unused properties. 2019-03-11 17:01:28 +02:00
Johann-S dce47b5451 scrollspy.js: remove unused properties 2019-03-11 17:01:28 +02:00
XhmikosR 5ac1a12625 Remove assignment from return. 2019-03-11 17:01:28 +02:00
XhmikosR 46c037410b Comply to the new rules. 2019-03-11 17:01:28 +02:00
XhmikosR f7b55da450
dom/manipulator.js: minor simplification. (#28358)
Combine two checks since we return the same value for both.
2019-02-26 13:13:01 +02:00
Johann-S 8a37045b79 move util in a util folder with the sanitizer 2019-02-26 13:04:04 +02:00
Johann-S fee11fd7ae use our selector engine instead of native api 2019-02-20 22:05:45 +02:00
XhmikosR 68e6de42ec Use `Util.makeArray()`. 2019-02-20 22:05:45 +02:00
Johann-S e58b47cf74 improve event handler 2019-02-20 22:05:45 +02:00
XhmikosR 30861cbc6d Simplify checks. 2019-02-20 22:05:45 +02:00
XhmikosR 4b7c058a25 Remove unneeded ESLint suppression. 2019-02-20 22:05:45 +02:00
Johann-S 08227506f2 use only dataset to get data attributes 2019-02-20 22:05:45 +02:00
Johann-S 764bab2941 remove polyfills which override browsers default 2019-02-20 22:05:45 +02:00
XhmikosR f0c6b24bd7 4.3.1. 2019-02-20 22:05:45 +02:00
Joshua Wilson fdbb5db919 minor jQuery.hasclass removal (#28158) 2019-02-20 22:05:45 +02:00
Peter Blazejewicz cbd333185e Use consistent arrow class (#28105) 2019-02-20 22:05:45 +02:00
Emil Müller 049a500d18 Fixed Util.jQuery: window.$ is not reliable. Both Firefox and Chrome implements $ natively. 2019-02-20 22:05:45 +02:00
Johann-S 661db08eeb rewrite toast plugin without jquery 2019-02-20 22:05:45 +02:00
Johann-S 57d50b2134 Improve manipulator coverage 2019-02-20 22:05:45 +02:00
Alessandro Chitolina 6cfc78f2d9 Remove IE support and button bsChecked hack 2019-02-20 22:05:45 +02:00
Johann-S a2f1d79045 Refactor util plugin and some tests 2019-02-20 22:05:45 +02:00
Johann-S c44db783bf chore(update): bump to 4.1.3 2019-02-20 22:05:45 +02:00
Johann-S 467dd113c5 fix(plugins): save instance in constructor 2019-02-20 22:05:45 +02:00
Johann-S 0b726de94e fix(carousel): on load page create a carousel 2019-02-20 22:05:45 +02:00
Johann-S 6b0808354d fix(unit-test): dropdown, collapse and carousel 2019-02-20 22:05:45 +02:00
Johann-S 8010c010e9 fix(event-handler): use Object.key for passing values in an event 2019-02-20 22:05:45 +02:00
Johann-S 096413a994 fix(selector-engine): increase coverage for selector engine 2019-02-20 22:05:45 +02:00
Johann-S 4510e7e61d fix(util): remove extend 2019-02-20 22:05:45 +02:00
Johann-S b4a3b00ac8 fix(event-handler): remove polyfill and move it to index 2019-02-20 22:05:45 +02:00
Johann-S fe580a8e5a fix(polyfill): disable coverage for our polyfills 2019-02-20 22:05:45 +02:00
Johann-S 64591b3722 fix(manipulator): increase coverage for manipulator 2019-02-20 22:05:45 +02:00
Johann-S 4d6e41dea6 refactor(polyfill): a file for polyfills 2019-02-20 22:05:45 +02:00
Johann-S 0b719e065c fix(data): increase coverage for data 2019-02-20 22:05:45 +02:00
Johann-S 2b78078779 fix(data): do not use data object in our unit tests 2019-02-20 22:05:45 +02:00
Johann-S 7eddee286e remove old references to jquery and some fixes 2019-02-20 22:05:45 +02:00
Alessandro Chitolina 0263d1742c rewritten scrollspy without jquery 2019-02-20 22:05:45 +02:00
Johann-S 9744886519 upgrade to v4 stable 2019-02-20 22:05:45 +02:00
Alessandro Chitolina 7f08061eca rewritten tab without jquery 2019-02-20 22:05:45 +02:00
Johann-S 90261b484c Dropdown without jQuery 2019-02-20 22:05:45 +02:00
Alessandro Chitolina ec69de4b7e allow register the same handler for different delegated selectors in eventHandler 2019-02-20 22:05:45 +02:00
Johann-S 99c3119c82 Return a new function with Util.noop 2019-02-20 22:05:45 +02:00
Johann-S b5077a1a81 fix one forgets of using jQuery in Carousel and Tooltip 2019-02-20 22:05:45 +02:00
Johann-S 2929bf9619 fix weird case with jQuery 2019-02-20 22:05:45 +02:00
Alessandro Chitolina cc6e130fc1 tooltip without jquery 2019-02-20 22:05:45 +02:00
Johann-S 7c1d0a1097 Wrap our objects into IIFE 2019-02-20 22:05:45 +02:00
Johann-S 69e4d4f3ac Rewrite Collapse without jQuery 2019-02-20 22:05:45 +02:00
Alessandro Chitolina 53ca76ebc0 Workaround for M$ Edge resetting defaultPrevented flag upon dispatchEvent 2019-02-20 22:05:45 +02:00
Alessandro Chitolina 33211eefdf Rewritten modal without jquery (#23955)
* Trigger jquery events if available in event handler

* Rewritten modal without jquery
2019-02-20 22:05:45 +02:00
Johann-S 9f9712b98c Add Manipulator object to add shortcuts for dom manipulations 2019-02-20 22:05:45 +02:00
Johann-S 44f38e4128 Rewrite carousel without jquery 2019-02-20 22:05:45 +02:00
Johann-S c5595e5b67 Add polyfill for focusin and focusout 2019-02-20 22:05:45 +02:00
XhmikosR aba87279fd button without jquery 2019-02-20 22:05:45 +02:00
Johann-S 47242cd0fe Fix delegation events 2019-02-20 22:05:45 +02:00
Johann-S 7d7873b6f2 Check jQuery version only if jQuery is available 2019-02-20 22:05:45 +02:00
Johann-S 6b5850212e Second element of find and findOne should be optional, not the first one 2019-02-20 22:05:45 +02:00
Johann-S b69fa9db95 Fix our data storage 2019-02-20 22:05:45 +02:00
Johann-S f2f69970eb Add findOne to our SelectorEngine 2019-02-20 22:05:45 +02:00
Johann-S 79144adb12 Fix detection of nativeEvents + trigger events with arguments 2019-02-20 22:05:45 +02:00
XhmikosR 3e8bc9d9ec Extend `SelectorEngine.find()` to include an `element` first arg.
If not supplied, it'll just use `document`.
2019-02-20 22:05:45 +02:00
Johann-S 3664d14908 fix declaration of alert jquery plugin only if jquery is available 2019-02-20 22:05:45 +02:00
Johann-S 4aef395e49 Disable ESlint on no-return-assign and temporary for arrow-body-style 2019-02-20 22:05:45 +02:00
Johann-S 2970d14dd9 Remove jQuery from alert.js and add .alert only if jQuery is available 2019-02-20 22:05:45 +02:00