0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00
Commit Graph

2063 Commits

Author SHA1 Message Date
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
GeoSot
90b1a6907e Merge js-components 'transitionend' listener callbacks into one method 2021-05-10 13:59:55 -07:00
Nagarjun Bodduna
741fa589d0
Fix backdrop rootElement not initialized in Modal (#33853)
* Initialize default value of rootElement before using

* Remove redundant test | put rootElement tests together

Co-authored-by: GeoSot <geo.sotis@gmail.com>
2021-05-10 21:17:53 +03:00
XhmikosR
bf09367486
Release v5.0.0 (#33647)
* Bump version to 5.0.0

* Fix npm tag

* Dist
2021-05-05 22:32:12 +03:00
GeoSot
d381820d16
Scrollbar: respect the initial body overflow value (#33706)
* add method to handle overflow on body element & tests
* replace duplicated code on modal/offcanvas tests
2021-04-25 06:50:16 +03:00
alpadev
e2294ff090
Add missing test for clicking select option in a dropdown (#33734) 2021-04-25 06:45:08 +03:00
Carson Sievert
2cbb0a941c
Dropdown: support .dropdown-item wrapped in <li> tags (#33634)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-04-21 08:30:19 +03:00
GeoSot
079f2cd90c
Offcanvas.js: If scroll is allowed, should allow focus on other elements (#33677) 2021-04-20 08:32:52 +03:00
GeoSot
0bbe45cd97
Tab.js: Fixes on click handling (#33586)
* use prevent default only if triggered by anchor
* disable auto-initialization if trigger is disabled
2021-04-20 08:26:58 +03:00
Rohit Sharma
b59b75bc55
Dropdown — Add option to make the dropdown menu clickable (#33389) 2021-04-20 08:19:57 +03:00
Rohit Sharma
a22f4d3cfd
Don't change the value for altBoundary option (#33684)
- Since bootstrap is not changing the default value of `elementContext`
  option, changing the value of `altBoundary` option is not needed for
any modifier in real

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-04-19 19:58:45 +03:00
alpadev
d67121db28
Fix regression for handling mouseenter/mouseleave events introduced by #33310 (#33679)
* test: update spec for sibling adjacent mouseenter/mouseleave events

there is a regression introduced by #33310 - this would have catched that

* fix: fixup regression for mouseenter/mouseleave events introduced by #33310

the old logic only worked for parent-child movement since it checked for the relatedTarget to contain the delegateTarget - this should be fixed with this

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-04-19 08:30:33 +03:00
GeoSot
a9d7a62658
Use the backdrop util in offcanvas, enforcing consistency (#33545)
* respect /share modal's backdrop functionality, keeping consistency
* listen click events over backdrop (only) and trigger `hide()` without add/remove event tricks
* achieve to hide foreign open offcanvas instances without glitches `if (allReadyOpen && allReadyOpen !== target)`, in case another is going to be open, when user clicks on trigger button
2021-04-19 08:20:25 +03:00
GeoSot
6ea4dab142
modal.js: fix test for scrollbar (#33666)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-04-18 20:55:22 -07:00
alpadev
6d312b37c2
fix: clicking an item in navbar dropdown collapses the dropdown in firefox (#33643) 2021-04-18 09:01:23 +03:00
Rohit Sharma
7eadf73f03 Change toggle method to remove
Since the class `.show` must be removed
2021-04-18 08:47:50 +03:00
Rohit Sharma
bce4684d34 Use context properties 2021-04-18 08:47:50 +03:00
Rohit Sharma
38a79ec64c Refactor dropdown's hide functionality 2021-04-18 08:47:50 +03:00
Carson Sievert
69f5c0130b
Fix v5 regressions in tab dropdown functionality (#33626)
Scope selector to `dropdownElement` when adding active classes
2021-04-15 13:53:55 +03:00
GeoSot
80085a12f6
Decouple BackDrop from modal (#32439)
* Create backdrop.js util

* revert breaking changes

remove PromiseTimout usage

revert class name

* one more test | change bundlewatch.config

* add config obj to backdrop helper | tests for rootElement | use transitionend helper

* Minor tweaks — Renaming

Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-04-14 13:28:50 -07:00
GeoSot
0d440b0e14 Js: fix some tests 2021-04-14 13:25:44 -07:00
alpadev
db32b2380c
fix: make EventHandler better handle mouseenter/mouseleave events (#33310)
* fix: make EventHandler better handle mouseenter/mouseleave events

* refactor: simplify custom events regex and move it to a variable
2021-04-13 06:25:58 +03:00
alpadev
ad10f00d5e
refactor: make static selectMenuItem method private (#33589) 2021-04-11 18:34:46 +03:00