Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
* updated `shorter-js`
* updated `event-listener`
* code cleanup
  • Loading branch information
thednp committed Feb 12, 2022
1 parent d350427 commit 8da3acb
Show file tree
Hide file tree
Showing 46 changed files with 691 additions and 1,670 deletions.
20 changes: 9 additions & 11 deletions dist/bootstrap-native-v4-esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Native JavaScript for Bootstrap v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/)
* Native JavaScript for Bootstrap v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/)
* Copyright 2015-2022 © dnp_theme
* Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -143,7 +143,7 @@ function getDocument(node) {
/**
* A global array of possible `ParentNode`.
*/
var parentNodes = [Document, Node, Element, HTMLElement];
var parentNodes = [Document, Element, HTMLElement];

/**
* A global array with `Element` | `HTMLElement`.
Expand All @@ -155,19 +155,17 @@ var elementNodes = [Element, HTMLElement];
* or find one that matches a selector.
*
* @param {HTMLElement | Element | string} selector the input selector or target element
* @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into
* @param {(HTMLElement | Element | Document)=} parent optional node to look into
* @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result
*/
function querySelector(selector, parent) {
var selectorIsString = typeof selector === 'string';
var lookUp = parent && parentNodes.some(function (x) { return parent instanceof x; })
var lookUp = parentNodes.some(function (x) { return parent instanceof x; })
? parent : getDocument();

if (!selectorIsString && elementNodes.some(function (x) { return selector instanceof x; })) {
return selector;
}
// @ts-ignore -- `ShadowRoot` is also a node
return selectorIsString ? lookUp.querySelector(selector) : null;
// @ts-ignore
return elementNodes.some(function (x) { return selector instanceof x; })
// @ts-ignore
? selector : lookUp.querySelector(selector);
}

/** BSN v4 custom event */
Expand Down Expand Up @@ -2579,7 +2577,7 @@ function removeDataAPI(context) {
});
}

var version = "4.1.0alpha4";
var version = "4.1.0alpha5";

var Version = version;

Expand Down
4 changes: 2 additions & 2 deletions dist/bootstrap-native-v4-esm.min.js

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions dist/bootstrap-native-v4.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Native JavaScript for Bootstrap v4.1.0alpha4 (https://thednp.github.io/bootstrap.native/)
* Native JavaScript for Bootstrap v4.1.0alpha5 (https://thednp.github.io/bootstrap.native/)
* Copyright 2015-2022 © dnp_theme
* Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -149,7 +149,7 @@
/**
* A global array of possible `ParentNode`.
*/
var parentNodes = [Document, Node, Element, HTMLElement];
var parentNodes = [Document, Element, HTMLElement];

/**
* A global array with `Element` | `HTMLElement`.
Expand All @@ -161,19 +161,17 @@
* or find one that matches a selector.
*
* @param {HTMLElement | Element | string} selector the input selector or target element
* @param {(HTMLElement | Element | Node | Document)=} parent optional node to look into
* @param {(HTMLElement | Element | Document)=} parent optional node to look into
* @return {(HTMLElement | Element)?} the `HTMLElement` or `querySelector` result
*/
function querySelector(selector, parent) {
var selectorIsString = typeof selector === 'string';
var lookUp = parent && parentNodes.some(function (x) { return parent instanceof x; })
var lookUp = parentNodes.some(function (x) { return parent instanceof x; })
? parent : getDocument();

if (!selectorIsString && elementNodes.some(function (x) { return selector instanceof x; })) {
return selector;
}
// @ts-ignore -- `ShadowRoot` is also a node
return selectorIsString ? lookUp.querySelector(selector) : null;
// @ts-ignore
return elementNodes.some(function (x) { return selector instanceof x; })
// @ts-ignore
? selector : lookUp.querySelector(selector);
}

/** BSN v4 custom event */
Expand Down Expand Up @@ -2585,7 +2583,7 @@
});
}

var version = "4.1.0alpha4";
var version = "4.1.0alpha5";

var Version = version;

Expand Down
4 changes: 2 additions & 2 deletions dist/bootstrap-native-v4.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 8da3acb

Please sign in to comment.