Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
* some type improvements
* improvements to `bootstrapCustomEvent`

@fmasa
  • Loading branch information
thednp committed Dec 17, 2021
1 parent 6daa9bc commit 47a6c95
Show file tree
Hide file tree
Showing 63 changed files with 5,254 additions and 2,793 deletions.
4 changes: 4 additions & 0 deletions assets/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ html {
/* misc */
.popover .close {line-height: 0.75;}
.popover .btn-close {position: absolute; right:0.75em}
[dir="rtl"] .popover .btn-close {
left: 0.75em;
right: auto;
}

/* bg */
.bg-bootstrap { background-color: #563d7c }
Expand Down
4 changes: 2 additions & 2 deletions assets/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ carouselGenericExample.addEventListener('slide.bs.carousel', function(e) {
var from = `\n> from index ${e.from}`;
var to = `\n> to index ${e.to}`;
var direction = `\n> with direction ${e.direction}`;
console.log('The "slide.bs.carousel" event fired for <div id=' + carouselGenericExample.id + '"> ' + direction + from + to + related);
console.log('The "slide.bs.carousel" event fired for <div id="' + carouselGenericExample.id + '"> ' + direction + from + to + related);
}, false);
carouselGenericExample.addEventListener('slid.bs.carousel', function(e) {
var related = `\n> relatedTarget <div class="${Array.from(e.relatedTarget.classList).join(' ')}">\n`;
var from = `\n> from index ${e.from}`;
var to = `\n> to index ${e.to}`;
var direction = `\n> with direction ${e.direction}`;
console.log('The "slid.bs.carousel" event fired for <div id=' + carouselGenericExample.id + '"> ' + direction + from + to + related);
console.log('The "slid.bs.carousel" event fired for <div id="' + carouselGenericExample.id + '"> ' + direction + from + to + related);
}, false);
19 changes: 15 additions & 4 deletions dist/bootstrap-native-v4-esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,28 @@ function emulateTransitionEnd(element, handler) {
}
}

/**
* Checks if an element is an `Element`.
*
* @param {any} element the target element
* @returns {boolean} the query result
*/
function isElement(element) {
return element instanceof Element;
}

/**
* Utility to check if target is typeof Element
* or find one that matches a selector.
*
* @param {Element | string} selector the input selector or target element
* @param {Element | null} parent optional Element to look into
* @return {Element | null} the Element or result of the querySelector
* @param {Element=} parent optional Element to look into
* @return {Element?} the Element or `querySelector` result
*/
function queryElement(selector, parent) {
var lookUp = parent && parent instanceof Element ? parent : document;
return selector instanceof Element ? selector : lookUp.querySelector(selector);
var lookUp = parent && isElement(parent) ? parent : document;
// @ts-ignore
return isElement(selector) ? selector : lookUp.querySelector(selector);
}

/** BSN v4 custom event */
Expand Down
2 changes: 1 addition & 1 deletion dist/bootstrap-native-v4-esm.min.js

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions dist/bootstrap-native-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,28 @@
}
}

/**
* Checks if an element is an `Element`.
*
* @param {any} element the target element
* @returns {boolean} the query result
*/
function isElement(element) {
return element instanceof Element;
}

/**
* Utility to check if target is typeof Element
* or find one that matches a selector.
*
* @param {Element | string} selector the input selector or target element
* @param {Element | null} parent optional Element to look into
* @return {Element | null} the Element or result of the querySelector
* @param {Element=} parent optional Element to look into
* @return {Element?} the Element or `querySelector` result
*/
function queryElement(selector, parent) {
var lookUp = parent && parent instanceof Element ? parent : document;
return selector instanceof Element ? selector : lookUp.querySelector(selector);
var lookUp = parent && isElement(parent) ? parent : document;
// @ts-ignore
return isElement(selector) ? selector : lookUp.querySelector(selector);
}

/** BSN v4 custom event */
Expand Down
2 changes: 1 addition & 1 deletion dist/bootstrap-native-v4.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 47a6c95

Please sign in to comment.